Possible small bug in xfsprogs-dev/db/metadump.c

Christoph Hellwig hch at infradead.org
Mon Sep 28 12:21:37 CDT 2009


[Cc'ed to the list, where people including the most active person on the
 userspace side hang out]

On Sun, Sep 27, 2009 at 12:20:33PM -0700, Richard Sharpe wrote:
> Hi folks,
> 
> There seems to be a small bug in
> xfsprogs-dev/db/metadump.c:scanfunc_freesp (although I think the same
> problem exists in other functions).
> 
> It has a check to see if the number of records is invalid:
> 
>         numrecs = be16_to_cpu(block->bb_numrecs);
>         if (numrecs > mp->m_alloc_mxr[1]) {
>                 if (show_warnings)
>                         print_warning("invalid numrecs (%u) in %s block %u/%u",
>                                 numrecs, typtab[btype].name, agno, agbno);
>                 return 1;
>         }
> 
> However, it seems to me that you should pay attention to bb_level in
> the node when using that test, because leaf nodes can appear at
> multiple levels in the tree.

Before that code there is a

	if (level == 0)
		return 1;

which should take care of the leaf nodes by exiting early.




More information about the xfs mailing list