Skip to content

Commit c4e51e4

Browse files
committed
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: [email protected] Closes: https://lore.kernel.org/r/[email protected] Message-ID: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 0bfe105 commit c4e51e4

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
@@ -202,7 +202,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer,
202202
struct urb *urb;
203203

204204
/* create message: */
205-
msg = kmalloc(sizeof(struct message), GFP_ATOMIC);
205+
msg = kzalloc(sizeof(struct message), GFP_ATOMIC);
206206
if (msg == NULL)
207207
return -ENOMEM;
208208

@@ -688,7 +688,7 @@ static int line6_init_cap_control(struct usb_line6 *line6)
688688
int ret;
689689

690690
/* initialize USB buffers: */
691-
line6->buffer_listen = kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL);
691+
line6->buffer_listen = kzalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL);
692692
if (!line6->buffer_listen)
693693
return -ENOMEM;
694694

@@ -697,7 +697,7 @@ static int line6_init_cap_control(struct usb_line6 *line6)
697697
return -ENOMEM;
698698

699699
if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI) {
700-
line6->buffer_message = kmalloc(LINE6_MIDI_MESSAGE_MAXLEN, GFP_KERNEL);
700+
line6->buffer_message = kzalloc(LINE6_MIDI_MESSAGE_MAXLEN, GFP_KERNEL);
701701
if (!line6->buffer_message)
702702
return -ENOMEM;
703703

0 commit comments

Comments
 (0)