summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-04-17 02:33:51 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-05-09 00:29:20 +0300
commit60f2b1bcf519416dbffee219132aa949d0c39d0e (patch)
treee3daafbeeb6b576182e5716ffe2b6fce77a04508
parent427e1bb8381899084fc316cce92dbc7508d9353b (diff)
downloadlinux-60f2b1bcf519416dbffee219132aa949d0c39d0e.tar.xz
bcachefs: Add asserts to bch2_dev_btree_bitmap_marked_sectors()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/sb-members.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/sb-members.c b/fs/bcachefs/sb-members.c
index 80bf09cfc021..50dc9f937c45 100644
--- a/fs/bcachefs/sb-members.c
+++ b/fs/bcachefs/sb-members.c
@@ -415,6 +415,9 @@ static void __bch2_dev_btree_bitmap_mark(struct bch_sb_field_members_v2 *mi, uns
m->btree_bitmap_shift += resize;
}
+ BUG_ON(m->btree_bitmap_shift > 57);
+ BUG_ON(end > 64ULL << m->btree_bitmap_shift);
+
for (unsigned bit = start >> m->btree_bitmap_shift;
(u64) bit << m->btree_bitmap_shift < end;
bit++)