xfs
[Top] [All Lists]

Re: [PATCH 9/9] xfsprogs: fix build warnings in repair

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH 9/9] xfsprogs: fix build warnings in repair
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 15 Jan 2010 18:09:23 +1100
In-reply-to: <1263463752-5052-10-git-send-email-david@xxxxxxxxxxxxx>
References: <1263463752-5052-1-git-send-email-david@xxxxxxxxxxxxx> <1263463752-5052-10-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.18 (2008-05-17)
On Thu, Jan 14, 2010 at 09:09:12PM +1100, Dave Chinner wrote:
> Rewrite the loop in btree_get_prev() so that the compiler
> can see that it returns if the cur->index is zero so it
> doesn't complain about possible array bound underflows
> when getting the key out of the buffer.
> 
> Fix the directory name sign warnings by casting to (uchar_t *)
> appropriately.
> 
> Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx>
> ---
>  repair/btree.c  |    9 +++++----
>  repair/phase6.c |   10 +++++-----
>  2 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/repair/btree.c b/repair/btree.c
> index 3141388..b53b4e4 100644
> --- a/repair/btree.c
> +++ b/repair/btree.c
> @@ -194,12 +194,13 @@ btree_get_prev(
>       }
>  
>       /* else need to go up and back down the tree to find the previous */
> -
> -     while (cur->index == 0) {
> -             if (++level == root->height)
> -                     return NULL;
> +     while (++level < root->height) {
> +             if (cur->index)
> +                     break;
>               cur++;
>       }
> +     if (cur->index == 0)
> +             return NULL;

This is broken - causes a segv. i have a fixed patch, which I'll
send out once I've got xfstests running again on my test box (using
dash as /bin/sh breaks *lots* of stuff in xfstests).

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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