projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0498a04
)
ALSA: usb-audio: Use snprintf instead of sprintf in build_mixer_unit_ctl
author
Zhu Jun
<zhujun2@cmss.chinamobile.com>
Wed, 9 Oct 2024 07:09:44 +0000
(
00:09
-0700)
committer
Takashi Iwai
<tiwai@suse.de>
Thu, 10 Oct 2024 12:23:01 +0000
(14:23 +0200)
Simplified code by removing redundant assignment of sprintf return value
and improved safety by replacing sprintf with snprintf.
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link:
https://patch.msgid.link/20241009070944.6937-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer.c
patch
|
blob
|
blame
|
history
diff --git
a/sound/usb/mixer.c
b/sound/usb/mixer.c
index 9945ae55b0d08ba5daa809112718aed0e6f6b884..b6c3d2ee416ea182f28c44d3a3058ab2d9b393dd 100644
(file)
--- a/
sound/usb/mixer.c
+++ b/
sound/usb/mixer.c
@@
-2224,7
+2224,8
@@
static void build_mixer_unit_ctl(struct mixer_build *state,
len = get_term_name(state->chip, iterm, kctl->id.name,
sizeof(kctl->id.name), 0);
if (!len)
- len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1);
+ snprintf(kctl->id.name, sizeof(kctl->id.name), "Mixer Source %d", in_ch + 1);
+
append_ctl_name(kctl, " Volume");
usb_audio_dbg(state->chip, "[%d] MU [%s] ch = %d, val = %d/%d\n",