Re: [syzbot] [integrity?] [lsm?] KMSAN: uninit-value in ima_add_template_entry (2)

From: Yuezhang.Mo@xxxxxxxx
Date: Thu Dec 12 2024 - 04:06:06 EST


#syz testFrom 51b0e3cfc5c0c4ac0000ff97d236d2434618f7fc Mon Sep 17 00:00:00 2001
From: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx>
Date: Thu, 12 Dec 2024 16:29:23 +0800
Subject: [PATCH v1] exfat: zero new buffer

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx>
---
fs/exfat/file.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index a25d7eb789f4..d91437831835 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -545,6 +545,7 @@ static int exfat_extend_valid_size(struct file *file, loff_t new_valid_size)
while (pos < new_valid_size) {
u32 len;
struct folio *folio;
+ unsigned long off;

len = PAGE_SIZE - (pos & (PAGE_SIZE - 1));
if (pos + len > new_valid_size)
@@ -554,6 +555,9 @@ static int exfat_extend_valid_size(struct file *file, loff_t new_valid_size)
if (err)
goto out;

+ off = offset_in_folio(folio, pos);
+ folio_zero_new_buffers(folio, off, off + len);
+
err = ops->write_end(file, mapping, pos, len, len, folio, NULL);
if (err < 0)
goto out;
@@ -563,6 +567,8 @@ static int exfat_extend_valid_size(struct file *file, loff_t new_valid_size)
cond_resched();
}

+ return 0;
+
out:
return err;
}
--
2.43.0