]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: fix build warnings in repair V2
authorDave Chinner <david@fromorbit.com>
Tue, 19 Jan 2010 22:13:15 +0000 (09:13 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 19 Jan 2010 22:13:15 +0000 (09:13 +1100)
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. Version 2 fixes
a height overflow in the reworked loop.

Fix the directory name sign warnings by casting to (uchar_t *)
appropriately.

Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/btree.c

index 31413888eca8300fb282f758d9967a642eacdb82..22ab4d912a401af6fe1d778bf7960828e68d990d 100644 (file)
@@ -194,12 +194,14 @@ 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;
+       do {
+               if (cur->index)
+                       break;
                cur++;
-       }
+       } while (++level < root->height);
+
+       if (level == root->height)
+               return NULL;
 
        /* the key is in the current level */
        if (key)