Re: [syzbot] [hfs?] KMSAN: uninit-value in __hfs_ext_cache_extent (2)

From: Qianqiang Liu
Date: Thu Oct 10 2024 - 09:43:00 EST


#syz test

diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index ef9498a6e88a..e66cb6e9f1fa 100644
--- a/fs/hfs/bfind.c
+++ b/fs/hfs/bfind.c
@@ -18,7 +18,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd)

fd->tree = tree;
fd->bnode = NULL;
- ptr = kmalloc(tree->max_key_len * 2 + 4, GFP_KERNEL);
+ ptr = kcalloc(tree->max_key_len * 2 + 4, 1, GFP_KERNEL);
if (!ptr)
return -ENOMEM;
fd->search_key = ptr;

--
Best,
Qianqiang Liu