xfs
[Top] [All Lists]

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

To: Richard Sharpe <realrichardsharpe@xxxxxxxxx>
Subject: Re: Possible small bug in xfsprogs-dev/db/metadump.c
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 28 Sep 2009 13:21:37 -0400
Cc: Dave Chinner <david@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <46b8a8850909271220w372d60c3s18a543ed00825082@xxxxxxxxxxxxxx>
References: <46b8a8850909271220w372d60c3s18a543ed00825082@xxxxxxxxxxxxxx>
User-agent: Mutt/1.5.19 (2009-01-05)
[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.

<Prev in Thread] Current Thread [Next in Thread>