mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-08 21:03:12 +00:00
scoutfs: bug if btree item creation corrupts
Add a BUG_ON() assertion for the case where we create an item that starts in the item offset array. This happens if the callers free space calculations are incorrect. It shouldn't be triggerable by corrupt blocks if we're verifying the blocks as we read them in. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -181,6 +181,9 @@ static struct scoutfs_btree_item *create_item(struct scoutfs_btree_block *bt,
|
||||
bt->item_offs[pos] = bt->free_end;
|
||||
bt->nr_items++;
|
||||
|
||||
BUG_ON(le16_to_cpu(bt->free_end) <
|
||||
offsetof(struct scoutfs_btree_block, item_offs[bt->nr_items]));
|
||||
|
||||
item = pos_item(bt, pos);
|
||||
item->key = *key;
|
||||
item->seq = bt->hdr.seq;
|
||||
|
||||
Reference in New Issue
Block a user