mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 04:56:13 +02:00
ALSA: ac97: Use safer strscpy() instead of strcpy()
Use a safer function strscpy() instead of strcpy() for copying to arrays. Only idiomatic code replacement, and no functional changes. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250710100727.22653-42-tiwai@suse.de
This commit is contained in:
parent
c9b4168294
commit
c9b7c4b628
|
|
@ -2303,7 +2303,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
|
|||
if (ac97_is_audio(ac97)) {
|
||||
char comp[16];
|
||||
if (card->mixername[0] == '\0') {
|
||||
strcpy(card->mixername, name);
|
||||
strscpy(card->mixername, name);
|
||||
} else {
|
||||
if (strlen(card->mixername) + 1 + strlen(name) + 1 <= sizeof(card->mixername)) {
|
||||
strcat(card->mixername, ",");
|
||||
|
|
@ -2324,7 +2324,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
|
|||
if (ac97_is_modem(ac97)) {
|
||||
char comp[16];
|
||||
if (card->mixername[0] == '\0') {
|
||||
strcpy(card->mixername, name);
|
||||
strscpy(card->mixername, name);
|
||||
} else {
|
||||
if (strlen(card->mixername) + 1 + strlen(name) + 1 <= sizeof(card->mixername)) {
|
||||
strcat(card->mixername, ",");
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ static int patch_yamaha_ymf7x3_3d(struct snd_ac97 *ac97)
|
|||
err = snd_ctl_add(ac97->bus->card, kctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(kctl->id.name, "3D Control - Wide");
|
||||
strscpy(kctl->id.name, "3D Control - Wide");
|
||||
kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 9, 7, 0);
|
||||
snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000);
|
||||
err = snd_ctl_add(ac97->bus->card,
|
||||
|
|
@ -891,7 +891,7 @@ static int patch_sigmatel_stac9700_3d(struct snd_ac97 * ac97)
|
|||
err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97));
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(kctl->id.name, "3D Control Sigmatel - Depth");
|
||||
strscpy(kctl->id.name, "3D Control Sigmatel - Depth");
|
||||
kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 2, 3, 0);
|
||||
snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000);
|
||||
return 0;
|
||||
|
|
@ -906,13 +906,13 @@ static int patch_sigmatel_stac9708_3d(struct snd_ac97 * ac97)
|
|||
err = snd_ctl_add(ac97->bus->card, kctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(kctl->id.name, "3D Control Sigmatel - Depth");
|
||||
strscpy(kctl->id.name, "3D Control Sigmatel - Depth");
|
||||
kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 0, 3, 0);
|
||||
kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97);
|
||||
err = snd_ctl_add(ac97->bus->card, kctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(kctl->id.name, "3D Control Sigmatel - Rear Depth");
|
||||
strscpy(kctl->id.name, "3D Control Sigmatel - Rear Depth");
|
||||
kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 2, 3, 0);
|
||||
snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user