* [PATCH] btrfs: zlib: zero-initialize zlib workspace
@ 2023-01-24 11:32 Alexander Potapenko
2023-01-24 16:59 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Potapenko @ 2023-01-24 11:32 UTC (permalink / raw)
To: glider
Cc: clm, dsterba, josef, linux-btrfs, linux-kernel, ebiggers,
syzbot+14d9e7602ebdf7ec0a60
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
Signed-off-by: Alexander Potapenko <glider@google.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: zlib: zero-initialize zlib workspace
2023-01-24 11:32 [PATCH] btrfs: zlib: zero-initialize zlib workspace Alexander Potapenko
@ 2023-01-24 16:59 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2023-01-24 16:59 UTC (permalink / raw)
To: Alexander Potapenko
Cc: clm, dsterba, josef, linux-btrfs, linux-kernel, ebiggers,
syzbot+14d9e7602ebdf7ec0a60
On Tue, Jan 24, 2023 at 12:32:34PM +0100, Alexander Potapenko wrote:
> 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
> Signed-off-by: Alexander Potapenko <glider@google.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-24 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-24 11:32 [PATCH] btrfs: zlib: zero-initialize zlib workspace Alexander Potapenko
2023-01-24 16:59 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.