mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
ALSA: ppc: 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-91-tiwai@suse.de
This commit is contained in:
parent
704a54b84f
commit
292e4adb95
@ -956,7 +956,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
|
|||||||
/*
|
/*
|
||||||
* build mixers
|
* build mixers
|
||||||
*/
|
*/
|
||||||
strcpy(chip->card->mixername, "PowerMac AWACS");
|
strscpy(chip->card->mixername, "PowerMac AWACS");
|
||||||
|
|
||||||
err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_mixers),
|
err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_mixers),
|
||||||
snd_pmac_awacs_mixers);
|
snd_pmac_awacs_mixers);
|
||||||
|
@ -665,7 +665,7 @@ int snd_pmac_burgundy_init(struct snd_pmac *chip)
|
|||||||
/*
|
/*
|
||||||
* build burgundy mixers
|
* build burgundy mixers
|
||||||
*/
|
*/
|
||||||
strcpy(chip->card->mixername, "PowerMac Burgundy");
|
strscpy(chip->card->mixername, "PowerMac Burgundy");
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(snd_pmac_burgundy_mixers); i++) {
|
for (i = 0; i < ARRAY_SIZE(snd_pmac_burgundy_mixers); i++) {
|
||||||
err = snd_ctl_add(chip->card,
|
err = snd_ctl_add(chip->card,
|
||||||
|
@ -261,7 +261,7 @@ int snd_pmac_daca_init(struct snd_pmac *chip)
|
|||||||
/*
|
/*
|
||||||
* build mixers
|
* build mixers
|
||||||
*/
|
*/
|
||||||
strcpy(chip->card->mixername, "PowerMac DACA");
|
strscpy(chip->card->mixername, "PowerMac DACA");
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(daca_mixers); i++) {
|
for (i = 0; i < ARRAY_SIZE(daca_mixers); i++) {
|
||||||
err = snd_ctl_add(chip->card, snd_ctl_new1(&daca_mixers[i], chip));
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&daca_mixers[i], chip));
|
||||||
|
@ -679,7 +679,7 @@ int snd_pmac_pcm_new(struct snd_pmac *chip)
|
|||||||
|
|
||||||
pcm->private_data = chip;
|
pcm->private_data = chip;
|
||||||
pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
|
pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
|
||||||
strcpy(pcm->name, chip->card->shortname);
|
strscpy(pcm->name, chip->card->shortname);
|
||||||
chip->pcm = pcm;
|
chip->pcm = pcm;
|
||||||
|
|
||||||
chip->formats_ok = SNDRV_PCM_FMTBIT_S16_BE;
|
chip->formats_ok = SNDRV_PCM_FMTBIT_S16_BE;
|
||||||
|
@ -55,8 +55,8 @@ static int snd_pmac_probe(struct platform_device *devptr)
|
|||||||
|
|
||||||
switch (chip->model) {
|
switch (chip->model) {
|
||||||
case PMAC_BURGUNDY:
|
case PMAC_BURGUNDY:
|
||||||
strcpy(card->driver, "PMac Burgundy");
|
strscpy(card->driver, "PMac Burgundy");
|
||||||
strcpy(card->shortname, "PowerMac Burgundy");
|
strscpy(card->shortname, "PowerMac Burgundy");
|
||||||
sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
|
sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
|
||||||
card->shortname, chip->device_id, chip->subframe);
|
card->shortname, chip->device_id, chip->subframe);
|
||||||
err = snd_pmac_burgundy_init(chip);
|
err = snd_pmac_burgundy_init(chip);
|
||||||
@ -64,8 +64,8 @@ static int snd_pmac_probe(struct platform_device *devptr)
|
|||||||
goto __error;
|
goto __error;
|
||||||
break;
|
break;
|
||||||
case PMAC_DACA:
|
case PMAC_DACA:
|
||||||
strcpy(card->driver, "PMac DACA");
|
strscpy(card->driver, "PMac DACA");
|
||||||
strcpy(card->shortname, "PowerMac DACA");
|
strscpy(card->shortname, "PowerMac DACA");
|
||||||
sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
|
sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
|
||||||
card->shortname, chip->device_id, chip->subframe);
|
card->shortname, chip->device_id, chip->subframe);
|
||||||
err = snd_pmac_daca_init(chip);
|
err = snd_pmac_daca_init(chip);
|
||||||
|
@ -951,9 +951,9 @@ static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto clean_irq;
|
goto clean_irq;
|
||||||
|
|
||||||
strcpy(the_card.card->driver, "PS3");
|
strscpy(the_card.card->driver, "PS3");
|
||||||
strcpy(the_card.card->shortname, "PS3");
|
strscpy(the_card.card->shortname, "PS3");
|
||||||
strcpy(the_card.card->longname, "PS3 sound");
|
strscpy(the_card.card->longname, "PS3 sound");
|
||||||
|
|
||||||
/* create control elements */
|
/* create control elements */
|
||||||
for (i = 0; i < ARRAY_SIZE(spdif_ctls); i++) {
|
for (i = 0; i < ARRAY_SIZE(spdif_ctls); i++) {
|
||||||
@ -975,7 +975,7 @@ static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
|
|||||||
goto clean_card;
|
goto clean_card;
|
||||||
|
|
||||||
the_card.pcm->private_data = &the_card;
|
the_card.pcm->private_data = &the_card;
|
||||||
strcpy(the_card.pcm->name, "SPDIF");
|
strscpy(the_card.pcm->name, "SPDIF");
|
||||||
|
|
||||||
/* set pcm ops */
|
/* set pcm ops */
|
||||||
snd_pcm_set_ops(the_card.pcm, SNDRV_PCM_STREAM_PLAYBACK,
|
snd_pcm_set_ops(the_card.pcm, SNDRV_PCM_STREAM_PLAYBACK,
|
||||||
|
Loading…
Reference in New Issue
Block a user