From: Josef Bacik Date: Tue, 7 Feb 2023 16:57:20 +0000 (-0500) Subject: btrfs: replace BUG_ON with ASSERT in btrfs_read_node_slot X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d46947284496e5dd1d5f6850790ec623a482b63a;p=linux.git btrfs: replace BUG_ON with ASSERT in btrfs_read_node_slot 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 Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index a5b6bb54545f6..a1c109d7956ae 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -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);