mirror of https://github.com/torvalds/linux.git
ALSA: opti9xx: 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-35-tiwai@suse.de
This commit is contained in:
parent
c7eaa0ebed
commit
b4a82a97c4
|
|
@ -718,10 +718,10 @@ static int snd_miro_mixer(struct snd_card *card,
|
|||
|
||||
switch (miro->hardware) {
|
||||
case OPTi9XX_HW_82C924:
|
||||
strcpy(card->mixername, "ACI & OPTi924");
|
||||
strscpy(card->mixername, "ACI & OPTi924");
|
||||
break;
|
||||
case OPTi9XX_HW_82C929:
|
||||
strcpy(card->mixername, "ACI & OPTi929");
|
||||
strscpy(card->mixername, "ACI & OPTi929");
|
||||
break;
|
||||
default:
|
||||
snd_BUG();
|
||||
|
|
@ -779,7 +779,7 @@ static int snd_miro_init(struct snd_miro *chip,
|
|||
static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
|
||||
|
||||
chip->hardware = hardware;
|
||||
strcpy(chip->name, snd_opti9xx_names[hardware]);
|
||||
strscpy(chip->name, snd_opti9xx_names[hardware]);
|
||||
|
||||
chip->mc_base_size = opti9xx_mc_size[hardware];
|
||||
|
||||
|
|
@ -1351,7 +1351,7 @@ static int snd_miro_probe(struct snd_card *card)
|
|||
sprintf(card->shortname, "unknown Cardinal Technologies");
|
||||
}
|
||||
|
||||
strcpy(card->driver, "miro");
|
||||
strscpy(card->driver, "miro");
|
||||
scnprintf(card->longname, sizeof(card->longname),
|
||||
"%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
|
||||
card->shortname, miro->name, codec->pcm->name,
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ static int snd_opti9xx_init(struct snd_opti9xx *chip,
|
|||
static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
|
||||
|
||||
chip->hardware = hardware;
|
||||
strcpy(chip->name, snd_opti9xx_names[hardware]);
|
||||
strscpy(chip->name, snd_opti9xx_names[hardware]);
|
||||
|
||||
spin_lock_init(&chip->lock);
|
||||
|
||||
|
|
@ -594,35 +594,35 @@ static int snd_opti93x_mixer(struct snd_wss *chip)
|
|||
|
||||
card = chip->card;
|
||||
|
||||
strcpy(card->mixername, chip->pcm->name);
|
||||
strscpy(card->mixername, chip->pcm->name);
|
||||
|
||||
memset(&id1, 0, sizeof(id1));
|
||||
memset(&id2, 0, sizeof(id2));
|
||||
id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
|
||||
/* reassign AUX0 switch to CD */
|
||||
strcpy(id1.name, "Aux Playback Switch");
|
||||
strcpy(id2.name, "CD Playback Switch");
|
||||
strscpy(id1.name, "Aux Playback Switch");
|
||||
strscpy(id2.name, "CD Playback Switch");
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0) {
|
||||
dev_err(card->dev, "Cannot rename opti93x control\n");
|
||||
return err;
|
||||
}
|
||||
/* reassign AUX1 switch to FM */
|
||||
strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
|
||||
strcpy(id2.name, "FM Playback Switch");
|
||||
strscpy(id1.name, "Aux Playback Switch"); id1.index = 1;
|
||||
strscpy(id2.name, "FM Playback Switch");
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0) {
|
||||
dev_err(card->dev, "Cannot rename opti93x control\n");
|
||||
return err;
|
||||
}
|
||||
/* remove AUX1 volume */
|
||||
strcpy(id1.name, "Aux Playback Volume"); id1.index = 1;
|
||||
strscpy(id1.name, "Aux Playback Volume"); id1.index = 1;
|
||||
snd_ctl_remove_id(card, &id1);
|
||||
|
||||
/* Replace WSS volume controls with OPTi93x volume controls */
|
||||
id1.index = 0;
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) {
|
||||
strcpy(id1.name, snd_opti93x_controls[idx].name);
|
||||
strscpy(id1.name, snd_opti93x_controls[idx].name);
|
||||
snd_ctl_remove_id(card, &id1);
|
||||
|
||||
err = snd_ctl_add(card,
|
||||
|
|
@ -857,7 +857,7 @@ static int snd_opti9xx_probe(struct snd_card *card)
|
|||
#endif
|
||||
chip->irq = irq;
|
||||
card->sync_irq = chip->irq;
|
||||
strcpy(card->driver, chip->name);
|
||||
strscpy(card->driver, chip->name);
|
||||
sprintf(card->shortname, "OPTi %s", card->driver);
|
||||
#if defined(CS4231) || defined(OPTi93X)
|
||||
scnprintf(card->longname, sizeof(card->longname),
|
||||
|
|
|
|||
Loading…
Reference in New Issue