]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: emu10k1: Use safer strscpy() instead of strcpy()
authorTakashi Iwai <tiwai@suse.de>
Thu, 10 Jul 2025 10:06:43 +0000 (12:06 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 11 Jul 2025 07:53:20 +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-62-tiwai@suse.de
sound/pci/emu10k1/emumpu401.c
sound/pci/emu10k1/emupcm.c
sound/pci/emu10k1/p16v.c
sound/pci/emu10k1/timer.c

index 747c34b3d566a4f3de3f24e916d4105cfdc3f149..efff19bbc0e9cd146d8246e6c677ef2b16f8683a 100644 (file)
@@ -320,7 +320,7 @@ static int emu10k1_midi_init(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *m
        spin_lock_init(&midi->open_lock);
        spin_lock_init(&midi->input_lock);
        spin_lock_init(&midi->output_lock);
-       strcpy(rmidi->name, name);
+       strscpy(rmidi->name, name);
        snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_emu10k1_midi_output);
        snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_emu10k1_midi_input);
        rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT |
index 1bf6e3d652f81448a563edc9c930b84eadcef5f0..5414148057ea7fa7714fc79fdc3848034b2e4714 100644 (file)
@@ -1425,7 +1425,7 @@ int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device)
 
        pcm->info_flags = 0;
        pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
-       strcpy(pcm->name, "ADC Capture/Standard PCM Playback");
+       strscpy(pcm->name, "ADC Capture/Standard PCM Playback");
        emu->pcm = pcm;
 
        /* playback substream can't use managed buffers due to alignment */
@@ -1457,7 +1457,7 @@ int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device)
 
        pcm->info_flags = 0;
        pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
-       strcpy(pcm->name, "Multichannel Playback");
+       strscpy(pcm->name, "Multichannel Playback");
        emu->pcm_multi = pcm;
 
        for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next)
@@ -1491,7 +1491,7 @@ int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device)
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_emu10k1_capture_mic_ops);
 
        pcm->info_flags = 0;
-       strcpy(pcm->name, "Mic Capture");
+       strscpy(pcm->name, "Mic Capture");
        emu->pcm_mic = pcm;
 
        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &emu->pci->dev,
@@ -1818,9 +1818,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)
 
        pcm->info_flags = 0;
        if (emu->audigy)
-               strcpy(pcm->name, "Multichannel Capture");
+               strscpy(pcm->name, "Multichannel Capture");
        else
-               strcpy(pcm->name, "Multichannel Capture/PT Playback");
+               strscpy(pcm->name, "Multichannel Capture/PT Playback");
        emu->pcm_efx = pcm;
 
        if (!emu->card_capabilities->emu_model) {
index a9a75891f1da4716d0df1568a10a8fe9f36e2d57..e774174d10de7a6dd2306bb57234f602af202029 100644 (file)
@@ -573,7 +573,7 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device)
 
        pcm->info_flags = 0;
        pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
-       strcpy(pcm->name, "p16v");
+       strscpy(pcm->name, "p16v");
        emu->pcm_p16v = pcm;
        emu->p16v_interrupt = snd_p16v_interrupt;
 
index bb2478319361a8d395d9ac70abd1bd1117e55816..1231ae2bf931364e14b0cadc37ef41cd243d57b5 100644 (file)
@@ -80,7 +80,7 @@ int snd_emu10k1_timer(struct snd_emu10k1 *emu, int device)
        tid.subdevice = 0;
        err = snd_timer_new(emu->card, "EMU10K1", &tid, &timer);
        if (err >= 0) {
-               strcpy(timer->name, "EMU10K1 timer");
+               strscpy(timer->name, "EMU10K1 timer");
                timer->private_data = emu;
                timer->hw = snd_emu10k1_timer_hw;
        }