[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230124113234.2070729-1-glider@google.com>
Date: Tue, 24 Jan 2023 12:32:34 +0100
From: Alexander Potapenko <glider@...gle.com>
To: glider@...gle.com
Cc: clm@...com, dsterba@...e.com, josef@...icpanda.com,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
ebiggers@...nel.org,
syzbot+14d9e7602ebdf7ec0a60@...kaller.appspotmail.com
Subject: [PATCH] btrfs: zlib: zero-initialize zlib workspace
KMSAN reports uses of uninitialized memory in zlib's longest_match()
called on memory originating from zlib_alloc_workspace().
This issue is known by zlib maintainers and is claimed to be harmless,
but to be on the safe side we'd better initialize the memory.
Link: https://zlib.net/zlib_faq.html#faq36
Reported-by: syzbot+14d9e7602ebdf7ec0a60@...kaller.appspotmail.com
Signed-off-by: Alexander Potapenko <glider@...gle.com>
---
fs/btrfs/zlib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index 01a13de118320..da7bb9187b68a 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -63,7 +63,7 @@ struct list_head *zlib_alloc_workspace(unsigned int level)
workspacesize = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
zlib_inflate_workspacesize());
- workspace->strm.workspace = kvmalloc(workspacesize, GFP_KERNEL);
+ workspace->strm.workspace = kvzalloc(workspacesize, GFP_KERNEL);
workspace->level = level;
workspace->buf = NULL;
/*
--
2.39.0.246.g2a6d74b583-goog
Powered by blists - more mailing lists