Skip to content

Commit

Permalink
ALSA: line6: Zero-initialize message buffers
Browse files Browse the repository at this point in the history
stable inclusion
from stable-v5.10.217
commit 602dd9d99a102e0cfa7a8caca34e043ebf504c59
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAWLXC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602dd9d99a102e0cfa7a8caca34e043ebf504c59

--------------------------------

[ 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]>
Signed-off-by: sanglipeng1 <[email protected]>
  • Loading branch information
tiwai authored and sanglipeng1 committed Oct 14, 2024
1 parent 8f59c33 commit cc4fd8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/usb/line6/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer,
struct urb *urb;

/* create message: */
msg = kmalloc(sizeof(struct message), GFP_ATOMIC);
msg = kzalloc(sizeof(struct message), GFP_ATOMIC);
if (msg == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -688,7 +688,7 @@ static int line6_init_cap_control(struct usb_line6 *line6)
int ret;

/* 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)
return -ENOMEM;

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

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)
return -ENOMEM;

Expand Down

0 comments on commit cc4fd8f

Please sign in to comment.