From 96d286d6e5d411621c8be96044631ffe17c8dbd3 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 13 Jan 2021 15:22:01 -0800 Subject: [PATCH] Zero btree item padding as items are created Item creation, which fills out a new item at the end of the array of item structs at the start of the block, didn't explicitly zero the item struct padding to 0. It would only have been zero if the memory was already zero, which is likely for new blocks, but isn't necessarily true if the memory had previously been used by deleted values. Signed-off-by: Zach Brown --- kmod/src/btree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kmod/src/btree.c b/kmod/src/btree.c index b87a5e72..808cbaa8 100644 --- a/kmod/src/btree.c +++ b/kmod/src/btree.c @@ -521,6 +521,7 @@ static void create_item(struct scoutfs_btree_block *bt, item->val_off = insert_value(bt, ptr_off(bt, item), val, val_len); item->val_len = cpu_to_le16(val_len); + memset(item->__pad, 0, sizeof(item->__pad)); le16_add_cpu(&bt->total_item_bytes, item_bytes(item)); }