aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/bcachefs/util.h')
-rw-r--r--fs/bcachefs/util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h
index 7ffbddb80400d..175aee3074c7d 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; \