Re: [syzbot] [hfs?] KMSAN: uninit-value in hfs_free_fork

Gianfranco Trad
2024-10-22T22:12:04Z

[-- Attachment #1: Type: text/plain, Size: 9 bytes --]

#syz test

[-- Attachment #2: 0001-hfs-use-kzalloc-in-hfs_find_init.patch --]
[-- Type: text/x-patch, Size: 770 bytes --]

From 0fb9dbd8a0e88e6e4011c9c97701f40b8d845831 Mon Sep 17 00:00:00 2001
From: Gianfranco Trad <gianf.trad@gmail.com>
Date: Wed, 23 Oct 2024 00:10:04 +0200
Subject: [PATCH] hfs: use kzalloc in hfs_find_init()

Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com>
---
fs/hfs/bfind.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index ef9498a6e88a..c74d864bc29e 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 = kzalloc(tree->max_key_len * 2 + 4, GFP_KERNEL);
if (!ptr)
return -ENOMEM;
fd->search_key = ptr;
--
2.43.0