btrfs-progs: fix compiler warning
authorChristian Hesse <mail@eworm.de>
Tue, 3 Jun 2014 11:29:19 +0000 (13:29 +0200)
committerDavid Sterba <dsterba@suse.cz>
Tue, 18 Nov 2014 17:25:58 +0000 (18:25 +0100)
gcc 4.9.0 gives a warning: array subscript is above array bounds

Checking for "greater or equal" instead of just "equal" fixes this.

The warning is a false positive, appears with -ftree-vrp, but we'd
rather fix it to avoid noise during build.

http://www.mail-archive.com/linux-btrfs%40vger.kernel.org/msg34338.html

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: David Sterba <dsterba@suse.cz>
cmds-restore.c

index b52d5c8..2f9b72d 100644 (file)
@@ -176,7 +176,7 @@ again:
                        break;
        }
 
-       if (level == BTRFS_MAX_LEVEL)
+       if (level >= BTRFS_MAX_LEVEL)
                return 1;
 
        slot = path->slots[level] + 1;