Skip to contentSkip to conversation

Btrfs-progs: check all slots in leaves

PATCH New Josef Bacik 1 participant 1 message Sep 30, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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,

---
 ctree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ctree.c +1 -1
index 9e5b30f..c085941 100644
@@ -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) {
Signature · 1 line
1.8.3.1