Commit c4e51e42 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: line6: Zero-initialize message buffers

For shutting up spurious KMSAN uninit-value warnings, just replace
kmalloc() calls with kzalloc() for the buffers used for
communications.  There should be no real issue with the original code,
but it's still better to cover.

Reported-by: syzbot+7fb05ccf7b3d2f9617b3@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/00000000000084b18706150bcca5@google.com
Message-ID: <20240402063628.26609-1-tiwai@suse.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0bfe1050
...@@ -202,7 +202,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer, ...@@ -202,7 +202,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer,
struct urb *urb; struct urb *urb;
/* create message: */ /* create message: */
msg = kmalloc(sizeof(struct message), GFP_ATOMIC); msg = kzalloc(sizeof(struct message), GFP_ATOMIC);
if (msg == NULL) if (msg == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -688,7 +688,7 @@ static int line6_init_cap_control(struct usb_line6 *line6) ...@@ -688,7 +688,7 @@ static int line6_init_cap_control(struct usb_line6 *line6)
int ret; int ret;
/* initialize USB buffers: */ /* initialize USB buffers: */
line6->buffer_listen = kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL); line6->buffer_listen = kzalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL);
if (!line6->buffer_listen) if (!line6->buffer_listen)
return -ENOMEM; return -ENOMEM;
...@@ -697,7 +697,7 @@ static int line6_init_cap_control(struct usb_line6 *line6) ...@@ -697,7 +697,7 @@ static int line6_init_cap_control(struct usb_line6 *line6)
return -ENOMEM; return -ENOMEM;
if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI) { if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI) {
line6->buffer_message = kmalloc(LINE6_MIDI_MESSAGE_MAXLEN, GFP_KERNEL); line6->buffer_message = kzalloc(LINE6_MIDI_MESSAGE_MAXLEN, GFP_KERNEL);
if (!line6->buffer_message) if (!line6->buffer_message)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment