summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2023-01-24 12:32:34 +0100
committerDavid Sterba <dsterba@suse.com>2023-01-25 20:11:08 +0100
commiteadd7deca0ad8a83edb2b894d8326c78e78635d6 (patch)
treef3d82662280e14ea01344621901292fd3974c1b8 /fs
parent3c538de0f2a74d50aff7278c092f88ae59cee688 (diff)
downloadlinux-stable-eadd7deca0ad8a83edb2b894d8326c78e78635d6.tar.gz
linux-stable-eadd7deca0ad8a83edb2b894d8326c78e78635d6.tar.bz2
linux-stable-eadd7deca0ad8a83edb2b894d8326c78e78635d6.zip
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@syzkaller.appspotmail.com CC: stable@vger.kernel.org # 5.4+ Signed-off-by: Alexander Potapenko <glider@google.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/zlib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index 01a13de11832..da7bb9187b68 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;
/*