Re: [syzbot] [sound?] KMSAN: uninit-value in line6_midibuf_read

Edward Adam Davis
2024-07-24T01:04:30Z

when alloc buffer for midi_buffer->buf, init mem to 0

#syz test: upstream 2c9b3512402e

diff --git a/sound/usb/line6/midibuf.c b/sound/usb/line6/midibuf.c
index e7f830f7526c..1b699cb3b38d 100644
--- a/sound/usb/line6/midibuf.c
+++ b/sound/usb/line6/midibuf.c
@@ -48,7 +48,7 @@ void line6_midibuf_reset(struct midi_buffer *this)

int line6_midibuf_init(struct midi_buffer *this, int size, int split)
{
- this->buf = kmalloc(size, GFP_KERNEL);
+ this->buf = kzalloc(size, GFP_KERNEL);

if (this->buf == NULL)
return -ENOMEM;