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

From: Edward Adam Davis
Date: Wed Nov 06 2024 - 01:40:46 EST


bnode's record key length is smaller than 8?

#syz test

diff --git a/fs/hfsplus/bfind.c b/fs/hfsplus/bfind.c
index 901e83d65d20..70deb143e518 100644
--- a/fs/hfsplus/bfind.c
+++ b/fs/hfsplus/bfind.c
@@ -116,7 +116,8 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd,
rec = (e + b) / 2;
len = hfs_brec_lenoff(bnode, rec, &off);
keylen = hfs_brec_keylen(bnode, rec);
- if (keylen == 0) {
+ printk("keylen: %u, off: %u, key: %p, %s\n", keylen, off, fd->key, __func__);
+ if (keylen < 8) {
res = -EINVAL;
goto fail;
}