mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 10:20:17 -04:00
ALSA: via82xx: 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-87-tiwai@suse.de
This commit is contained in:
@@ -1436,7 +1436,7 @@ static int snd_via8233_pcm_new(struct via82xx *chip)
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via8233_playback_ops);
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via8233_capture_ops);
|
||||
pcm->private_data = chip;
|
||||
strcpy(pcm->name, chip->card->shortname);
|
||||
strscpy(pcm->name, chip->card->shortname);
|
||||
chip->pcms[0] = pcm;
|
||||
/* set up playbacks */
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -1461,7 +1461,7 @@ static int snd_via8233_pcm_new(struct via82xx *chip)
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via8233_multi_ops);
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via8233_capture_ops);
|
||||
pcm->private_data = chip;
|
||||
strcpy(pcm->name, chip->card->shortname);
|
||||
strscpy(pcm->name, chip->card->shortname);
|
||||
chip->pcms[1] = pcm;
|
||||
/* set up playback */
|
||||
init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 4, 0);
|
||||
@@ -1504,7 +1504,7 @@ static int snd_via8233a_pcm_new(struct via82xx *chip)
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via8233_multi_ops);
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via8233_capture_ops);
|
||||
pcm->private_data = chip;
|
||||
strcpy(pcm->name, chip->card->shortname);
|
||||
strscpy(pcm->name, chip->card->shortname);
|
||||
chip->pcms[0] = pcm;
|
||||
/* set up playback */
|
||||
init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 4, 0);
|
||||
@@ -1532,7 +1532,7 @@ static int snd_via8233a_pcm_new(struct via82xx *chip)
|
||||
return err;
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via8233_playback_ops);
|
||||
pcm->private_data = chip;
|
||||
strcpy(pcm->name, chip->card->shortname);
|
||||
strscpy(pcm->name, chip->card->shortname);
|
||||
chip->pcms[1] = pcm;
|
||||
/* set up playback */
|
||||
init_viadev(chip, chip->playback_devno, 0x30, 3, 0);
|
||||
@@ -1562,7 +1562,7 @@ static int snd_via686_pcm_new(struct via82xx *chip)
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via686_playback_ops);
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via686_capture_ops);
|
||||
pcm->private_data = chip;
|
||||
strcpy(pcm->name, chip->card->shortname);
|
||||
strscpy(pcm->name, chip->card->shortname);
|
||||
chip->pcms[0] = pcm;
|
||||
init_viadev(chip, 0, VIA_REG_PLAYBACK_STATUS, 0, 0);
|
||||
init_viadev(chip, 1, VIA_REG_CAPTURE_STATUS, 0, 1);
|
||||
@@ -2461,7 +2461,7 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
|
||||
card_type = pci_id->driver_data;
|
||||
switch (card_type) {
|
||||
case TYPE_CARD_VIA686:
|
||||
strcpy(card->driver, "VIA686A");
|
||||
strscpy(card->driver, "VIA686A");
|
||||
sprintf(card->shortname, "VIA 82C686A/B rev%x", pci->revision);
|
||||
chip_type = TYPE_VIA686;
|
||||
break;
|
||||
@@ -2471,7 +2471,7 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
|
||||
for (i = 0; i < ARRAY_SIZE(via823x_cards); i++) {
|
||||
if (pci->revision == via823x_cards[i].revision) {
|
||||
chip_type = via823x_cards[i].type;
|
||||
strcpy(card->shortname, via823x_cards[i].name);
|
||||
strscpy(card->shortname, via823x_cards[i].name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2487,11 +2487,11 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
|
||||
chip_type = TYPE_VIA8233;
|
||||
}
|
||||
if (chip_type == TYPE_VIA8233A)
|
||||
strcpy(card->driver, "VIA8233A");
|
||||
strscpy(card->driver, "VIA8233A");
|
||||
else if (pci->revision >= VIA_REV_8237)
|
||||
strcpy(card->driver, "VIA8237"); /* no slog assignment */
|
||||
strscpy(card->driver, "VIA8237"); /* no slog assignment */
|
||||
else
|
||||
strcpy(card->driver, "VIA8233");
|
||||
strscpy(card->driver, "VIA8233");
|
||||
break;
|
||||
default:
|
||||
dev_err(card->dev, "invalid card type %d\n", card_type);
|
||||
|
||||
@@ -842,7 +842,7 @@ static int snd_via686_pcm_new(struct via82xx_modem *chip)
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via686_capture_ops);
|
||||
pcm->dev_class = SNDRV_PCM_CLASS_MODEM;
|
||||
pcm->private_data = chip;
|
||||
strcpy(pcm->name, chip->card->shortname);
|
||||
strscpy(pcm->name, chip->card->shortname);
|
||||
chip->pcms[0] = pcm;
|
||||
init_viadev(chip, 0, VIA_REG_MO_STATUS, 0);
|
||||
init_viadev(chip, 1, VIA_REG_MI_STATUS, 1);
|
||||
@@ -1116,7 +1116,7 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
|
||||
card_type = pci_id->driver_data;
|
||||
switch (card_type) {
|
||||
case TYPE_CARD_VIA82XX_MODEM:
|
||||
strcpy(card->driver, "VIA82XX-MODEM");
|
||||
strscpy(card->driver, "VIA82XX-MODEM");
|
||||
sprintf(card->shortname, "VIA 82XX modem");
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user