Skip to content

Commit 009c105

Browse files
tiwaiwcedla
authored andcommitted
ALSA: line6: Zero-initialize message buffers
[ Upstream commit c4e51e424e2c772ce1836912a8b0b87cd61bc9d5 ] 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: [email protected] Closes: https://lore.kernel.org/r/[email protected] Message-ID: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 6acf242 commit 009c105

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/usb/line6/driver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer,
216216
struct urb *urb;
217217

218218
/* create message: */
219-
msg = kmalloc(sizeof(struct message), GFP_ATOMIC);
219+
msg = kzalloc(sizeof(struct message), GFP_ATOMIC);
220220
if (msg == NULL)
221221
return -ENOMEM;
222222

@@ -694,7 +694,7 @@ static int line6_init_cap_control(struct usb_line6 *line6)
694694
int ret;
695695

696696
/* initialize USB buffers: */
697-
line6->buffer_listen = kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL);
697+
line6->buffer_listen = kzalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL);
698698
if (!line6->buffer_listen)
699699
return -ENOMEM;
700700

@@ -703,7 +703,7 @@ static int line6_init_cap_control(struct usb_line6 *line6)
703703
return -ENOMEM;
704704

705705
if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI) {
706-
line6->buffer_message = kmalloc(LINE6_MIDI_MESSAGE_MAXLEN, GFP_KERNEL);
706+
line6->buffer_message = kzalloc(LINE6_MIDI_MESSAGE_MAXLEN, GFP_KERNEL);
707707
if (!line6->buffer_message)
708708
return -ENOMEM;
709709

0 commit comments

Comments
 (0)