btrfs: zlib: zero-initialize zlib workspace
PATCH 1/1 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.
Reported-by [email protected]
Signed-off-by Alexander Potapenko <[email protected]>
--- fs/btrfs/zlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/zlib.c +1 -1
@@ -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 ;/*
Signature · 1 line
2.39.0.246.g2a6d74b583-goog
Quoted 8 lines · Alexander Potapenko
KMSAN reports uses of uninitialized memory in zlib's
longest_match()called on memory originating fromzlib_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.Reported-by [email protected]Signed-off-by Alexander Potapenko <[email protected]>
Added to misc-next, thanks.