diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-17 02:22:47 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-18 02:17:38 +0100 |
commit | a58603684195ea892da5612580762fd3151b2a7b (patch) | |
tree | c716679279dfab8d1f758e542da8e86c0d5aef96 /fs/bcachefs/util.h | |
parent | bcachefs: fix for building in userspace (diff) | |
download | linux-a58603684195ea892da5612580762fd3151b2a7b.tar.xz linux-a58603684195ea892da5612580762fd3151b2a7b.zip |
bcachefs: Don't corrupt journal keys gap buffer when dropping alloc info
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/util.h')
-rw-r--r-- | fs/bcachefs/util.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index 7ffbddb80400..175aee3074c7 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h @@ -683,6 +683,9 @@ static inline void __move_gap(void *array, size_t element_size, /* Move the gap in a gap buffer: */ #define move_gap(_d, _new_gap) \ do { \ + BUG_ON(_new_gap > (_d)->nr); \ + BUG_ON((_d)->gap > (_d)->nr); \ + \ __move_gap((_d)->data, sizeof((_d)->data[0]), \ (_d)->nr, (_d)->size, (_d)->gap, _new_gap); \ (_d)->gap = _new_gap; \ |