mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ALSA: usb-audio: Use strscpy() in append_ctl_name()
To prepare for removing strlcat() from the kernel [1], use strscpy() instead with the current name length as the append offset. Change append_ctl_name() to return void since no caller uses its return value. Use append_ctl_name() to append " Jack" in build_connector_control(). No functional change. Link: https://github.com/KSPP/linux/issues/370 [1] Signed-off-by: Thorsten Blum <blum@kernel.org> Link: https://patch.msgid.link/20261021105826.147060-3-blum@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
8045043c9d
commit
d158ee133e
|
|
@ -1781,9 +1781,11 @@ const struct snd_kcontrol_new *snd_usb_feature_unit_ctl = &usb_feature_unit_ctl;
|
|||
/*
|
||||
* build a feature control
|
||||
*/
|
||||
static size_t append_ctl_name(struct snd_kcontrol *kctl, const char *str)
|
||||
static void append_ctl_name(struct snd_kcontrol *kctl, const char *str)
|
||||
{
|
||||
return strlcat(kctl->id.name, str, sizeof(kctl->id.name));
|
||||
size_t len = strlen(kctl->id.name);
|
||||
|
||||
strscpy(kctl->id.name + len, str, sizeof(kctl->id.name) - len);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -2151,7 +2153,7 @@ static void build_connector_control(struct usb_mixer_interface *mixer,
|
|||
}
|
||||
|
||||
if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name)))
|
||||
strlcat(kctl->id.name, " Jack", sizeof(kctl->id.name));
|
||||
append_ctl_name(kctl, " Jack");
|
||||
else
|
||||
get_connector_control_name(mixer, term, is_input, kctl->id.name,
|
||||
sizeof(kctl->id.name));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user