From: Dave Chinner Date: Tue, 19 Jan 2010 22:13:15 +0000 (+1100) Subject: xfsprogs: fix build warnings in repair V2 X-Git-Tag: v3.1.1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98566312c12da172111134294ea3a50d3ec94c4a;p=thirdparty%2Fxfsprogs-dev.git xfsprogs: fix build warnings in repair V2 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 --- diff --git a/repair/btree.c b/repair/btree.c index 31413888e..22ab4d912 100644 --- a/repair/btree.c +++ b/repair/btree.c @@ -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)