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

index 9922ab40798cfadd5cbe7a7ddc0237b27d49782c..ddb6ccc72e443d0df6ff55e5d78dd73bb3ee5ab3 100644 (file)
@@ -88,11 +88,11 @@ static int snd_trident_probe(struct pci_dev *pci,
        default:
                str = "Unknown";
        }
-       strcpy(card->driver, str);
+       strscpy(card->driver, str);
        if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
-               strcpy(card->shortname, "SiS ");
+               strscpy(card->shortname, "SiS ");
        } else {
-               strcpy(card->shortname, "Trident ");
+               strscpy(card->shortname, "Trident ");
        }
        strcat(card->shortname, str);
        sprintf(card->longname, "%s PCI Audio at 0x%lx, irq %d",
index 4e16b79d6584b10d2482474db76c4ce26fcf3961..39ed52bf8631ca674741531594b5a43f4cba4357 100644 (file)
@@ -2137,7 +2137,7 @@ int snd_trident_pcm(struct snd_trident *trident, int device)
 
        pcm->info_flags = 0;
        pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
-       strcpy(pcm->name, "Trident 4DWave");
+       strscpy(pcm->name, "Trident 4DWave");
        trident->pcm = pcm;
 
        if (trident->tlb.entries) {
@@ -2189,16 +2189,16 @@ int snd_trident_foldback_pcm(struct snd_trident *trident, int device)
        else
                snd_pcm_set_ops(foldback, SNDRV_PCM_STREAM_CAPTURE, &snd_trident_foldback_ops);
        foldback->info_flags = 0;
-       strcpy(foldback->name, "Trident 4DWave");
+       strscpy(foldback->name, "Trident 4DWave");
        substream = foldback->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
-       strcpy(substream->name, "Front Mixer");
+       strscpy(substream->name, "Front Mixer");
        substream = substream->next;
-       strcpy(substream->name, "Reverb Mixer");
+       strscpy(substream->name, "Reverb Mixer");
        substream = substream->next;
-       strcpy(substream->name, "Chorus Mixer");
+       strscpy(substream->name, "Chorus Mixer");
        if (num_chan == 4) {
                substream = substream->next;
-               strcpy(substream->name, "Second AC'97 ADC");
+               strscpy(substream->name, "Second AC'97 ADC");
        }
        trident->foldback = foldback;
 
@@ -2241,7 +2241,7 @@ int snd_trident_spdif_pcm(struct snd_trident *trident, int device)
                snd_pcm_set_ops(spdif, SNDRV_PCM_STREAM_PLAYBACK, &snd_trident_spdif_7018_ops);
        }
        spdif->info_flags = 0;
-       strcpy(spdif->name, "Trident 4DWave IEC958");
+       strscpy(spdif->name, "Trident 4DWave IEC958");
        trident->spdif = spdif;
 
        snd_pcm_set_managed_buffer_all(spdif, SNDRV_DMA_TYPE_DEV,