mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-30 09:21:45 +00:00
btrfs-progs: corrupt-block: improved error handling in corrupt_item_nocow
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
689b6249f3
commit
7b83595dbd
@ -899,7 +899,11 @@ static int corrupt_item_nocow(struct btrfs_trans_handle *trans,
|
||||
if (slot == 0)
|
||||
del = 0;
|
||||
/* Only accept valid eb */
|
||||
BUG_ON(!leaf->data || slot >= btrfs_header_nritems(leaf));
|
||||
if (!leaf->data || slot >= btrfs_header_nritems(leaf)) {
|
||||
error("invalid eb: no data or slot out of range: %d >= %d",
|
||||
slot, btrfs_header_nritems(leaf));
|
||||
return -EINVAL;
|
||||
}
|
||||
btrfs_item_key_to_cpu(leaf, &key, slot);
|
||||
if (del) {
|
||||
fprintf(stdout, "Deleting key and data [%llu, %u, %llu].\n",
|
||||
|
Loading…
Reference in New Issue
Block a user