ALSA: sh: 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-92-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2025-07-10 12:07:13 +02:00
parent 292e4adb95
commit 61d4db8f7c
2 changed files with 7 additions and 7 deletions

View File

@ -424,7 +424,7 @@ static int __init snd_aicapcmchip(struct snd_card_aica
if (unlikely(err < 0))
return err;
pcm->private_data = dreamcastcard;
strcpy(pcm->name, "AICA PCM");
strscpy(pcm->name, "AICA PCM");
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_aicapcm_playback_ops);
/* Allocate the DMA buffers */
@ -568,9 +568,9 @@ static int snd_aica_probe(struct platform_device *devptr)
kfree(dreamcastcard);
return err;
}
strcpy(dreamcastcard->card->driver, "snd_aica");
strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
strcpy(dreamcastcard->card->longname,
strscpy(dreamcastcard->card->driver, "snd_aica");
strscpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
strscpy(dreamcastcard->card->longname,
"Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");
/* Prepare to use the queue */
INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma);

View File

@ -224,7 +224,7 @@ static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)
return err;
pcm->private_data = chip;
strcpy(pcm->name, "SH_DAC PCM");
strscpy(pcm->name, "SH_DAC PCM");
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops);
/* buffer size=48K */
@ -358,8 +358,8 @@ static int snd_sh_dac_probe(struct platform_device *devptr)
if (err < 0)
goto probe_error;
strcpy(card->driver, "snd_sh_dac");
strcpy(card->shortname, "SuperH DAC audio driver");
strscpy(card->driver, "snd_sh_dac");
strscpy(card->shortname, "SuperH DAC audio driver");
dev_info(&devptr->dev, "%s %s\n", card->longname, card->shortname);
err = snd_card_register(card);