]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: sh: Use safer strscpy() instead of strcpy()
authorTakashi Iwai <tiwai@suse.de>
Thu, 10 Jul 2025 10:07:13 +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-92-tiwai@suse.de
sound/sh/aica.c
sound/sh/sh_dac_audio.c

index 40ea843113a7438cadab7b2e9d9f9a0e01331816..fa81bfba59c1463a58c5594696133969b71f27f0 100644 (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);
index 84a4b17a0cc236695e7fb9c7c27b3ed1aa5d16e1..164f91240d0202474c9aed6438937791421b4fda 100644 (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);