Skip to content

Commit 00f6868

Browse files
tiwaiShujathMohd
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]> (cherry picked from commit c957c9432f957007fef152a3efc9aabe4337ef4a) Signed-off-by: Vegard Nossum <[email protected]>
1 parent 0d9edc3 commit 00f6868

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/usb/line6/driver.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer,
209209
struct urb *urb;
210210

211211
/* create message: */
212-
msg = kmalloc(sizeof(struct message), GFP_ATOMIC);
212+
msg = kzalloc(sizeof(struct message), GFP_ATOMIC);
213213
if (msg == NULL)
214214
return -ENOMEM;
215215

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

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

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

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

0 commit comments

Comments
 (0)