summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2014-09-30 16:56:05 -0400
committerDavid Sterba <dsterba@suse.cz>2014-10-01 16:59:10 +0200
commite22ffdf94bea073e2f12cf198dc17116ac4b3a46 (patch)
tree449b2f73ad91c8f1e91110b529e2eef0a1f5408c
parent2c1b155988a9263bb5e4dc81c6a48c699f649789 (diff)
Btrfs-progs: check all slots in leaves
There's an off by one error in btrfs_check_leaf, we should be going to nritems - 1, not nritems - 2, we were missing problems with items in the very last slot. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r--ctree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ctree.c b/ctree.c
index 9e5b30f3..c0859416 100644
--- a/ctree.c
+++ b/ctree.c
@@ -494,7 +494,7 @@ btrfs_check_leaf(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
(unsigned long long)btrfs_header_bytenr(buf));
goto fail;
}
- for (i = 0; nritems > 1 && i < nritems - 2; i++) {
+ for (i = 0; nritems > 1 && i < nritems - 1; i++) {
btrfs_item_key(buf, &key, i);
btrfs_item_key_to_cpu(buf, &cpukey, i + 1);
if (btrfs_comp_keys(&key, &cpukey) >= 0) {