]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
btrfs: replace BUG_ON with ASSERT in btrfs_read_node_slot
authorJosef Bacik <josef@toxicpanda.com>
Tue, 7 Feb 2023 16:57:20 +0000 (11:57 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Apr 2023 16:01:13 +0000 (18:01 +0200)
In btrfs_read_node_slot() we have a BUG_ON() that can be converted to an
ASSERT(), it's from an extent buffer and the level is validated at the
time it's read from disk.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c

index a5b6bb54545f642fa5a1bb1d71884fa6824d1ff9..a1c109d7956aef7c8c700405bd8e5bd9d56ef30a 100644 (file)
@@ -959,7 +959,7 @@ struct extent_buffer *btrfs_read_node_slot(struct extent_buffer *parent,
        if (slot < 0 || slot >= btrfs_header_nritems(parent))
                return ERR_PTR(-ENOENT);
 
-       BUG_ON(level == 0);
+       ASSERT(level);
 
        check.level = level - 1;
        check.transid = btrfs_node_ptr_generation(parent, slot);