[PATCH] ALSA: line6: init buf to zero

From: Edward Adam Davis
Date: Wed Jul 24 2024 - 02:05:37 EST


Syzbot report KMSAN uninit-value warnings.
When alloc buffer for midi_buffer->buf, init mem to 0.

Reported-and-tested-by: syzbot+78eccfb8b3c9a85fc6c5@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=78eccfb8b3c9a85fc6c5
Signed-off-by: Edward Adam Davis <eadavis@xxxxxx>
---
sound/usb/line6/midibuf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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;
--
2.43.0