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

index 48444dda44defdad3ee3b30bd3ba40d3555111c1..764ca59e98d1d3ea87b24ed07390f1d898cb3834 100644 (file)
@@ -188,7 +188,7 @@ static int __snd_card_ymfpci_probe(struct pci_dev *pci,
        default: model = str = "???"; break;
        }
 
-       strcpy(card->driver, str);
+       strscpy(card->driver, str);
        sprintf(card->shortname, "Yamaha %s (%s)", model, str);
        sprintf(card->longname, "%s at 0x%lx, irq %i",
                card->shortname,
index d495f53a8324e7cdbc0a6195b9d56ec3bd976b86..75e013b66c5b3dbea743e9a7ade123cbd09f9594 100644 (file)
@@ -1134,7 +1134,7 @@ int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device)
 
        /* global setup */
        pcm->info_flags = 0;
-       strcpy(pcm->name, "YMFPCI");
+       strscpy(pcm->name, "YMFPCI");
        chip->pcm = pcm;
 
        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1201,7 +1201,7 @@ int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device)
 
        /* global setup */
        pcm->info_flags = 0;
-       strcpy(pcm->name, "YMFPCI - IEC958");
+       strscpy(pcm->name, "YMFPCI - IEC958");
        chip->pcm_spdif = pcm;
 
        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1242,7 +1242,7 @@ int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device)
 
        /* global setup */
        pcm->info_flags = 0;
-       strcpy(pcm->name, "YMFPCI - Rear PCM");
+       strscpy(pcm->name, "YMFPCI - Rear PCM");
        chip->pcm_4ch = pcm;
 
        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1948,7 +1948,7 @@ int snd_ymfpci_timer(struct snd_ymfpci *chip, int device)
        tid.subdevice = 0;
        err = snd_timer_new(chip->card, "YMFPCI", &tid, &timer);
        if (err >= 0) {
-               strcpy(timer->name, "YMFPCI timer");
+               strscpy(timer->name, "YMFPCI timer");
                timer->private_data = chip;
                timer->hw = snd_ymfpci_timer_hw;
        }