]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: spi: Use safer strscpy() instead of strcpy()
authorTakashi Iwai <tiwai@suse.de>
Thu, 10 Jul 2025 10:07:15 +0000 (12:07 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 11 Jul 2025 07:53:35 +0000 (09:53 +0200)
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-94-tiwai@suse.de
sound/spi/at73c213.c

index 8f6929ced2c8a659726b3a2937319471d5ea3d9b..a0a7f90b6146936c287f8078b21f31932c845c38 100644 (file)
@@ -336,7 +336,7 @@ static int snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device)
 
        pcm->private_data = chip;
        pcm->info_flags = SNDRV_PCM_INFO_BLOCK_TRANSFER;
-       strcpy(pcm->name, "at73c213");
+       strscpy(pcm->name, "at73c213");
        chip->pcm = pcm;
 
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &at73c213_playback_ops);
@@ -713,7 +713,7 @@ static int snd_at73c213_mixer(struct snd_at73c213 *chip)
 
        card = chip->card;
 
-       strcpy(card->mixername, chip->pcm->name);
+       strscpy(card->mixername, chip->pcm->name);
 
        for (idx = 0; idx < ARRAY_SIZE(snd_at73c213_controls); idx++) {
                errval = snd_ctl_add(card,
@@ -983,8 +983,8 @@ static int snd_at73c213_probe(struct spi_device *spi)
        if (retval)
                goto out_ssc;
 
-       strcpy(card->driver, "at73c213");
-       strcpy(card->shortname, board->shortname);
+       strscpy(card->driver, "at73c213");
+       strscpy(card->shortname, board->shortname);
        sprintf(card->longname, "%s on irq %d", card->shortname, chip->irq);
 
        retval = snd_card_register(card);