Skip to content

Commit eadd7de

Browse files
ramosian-gliderkdave
authored andcommitted
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: [email protected] CC: [email protected] # 5.4+ Signed-off-by: Alexander Potapenko <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 3c538de commit eadd7de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/zlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct list_head *zlib_alloc_workspace(unsigned int level)
6363

6464
workspacesize = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
6565
zlib_inflate_workspacesize());
66-
workspace->strm.workspace = kvmalloc(workspacesize, GFP_KERNEL);
66+
workspace->strm.workspace = kvzalloc(workspacesize, GFP_KERNEL);
6767
workspace->level = level;
6868
workspace->buf = NULL;
6969
/*

0 commit comments

Comments
 (0)