[PATCH] ALSA: line6: init buf to zero

Edward Adam Davis
2024-07-24T06:05:21Z

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

Reported-and-tested-by: syzbot+78eccfb8b3c9a85fc6c5@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=78eccfb8b3c9a85fc6c5
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
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