ALSA: sb: Replace deprecated strcpy() with strscpy()
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 12 May 2025 10:57:41 +0000 (12:57 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 13 May 2025 08:57:51 +0000 (10:57 +0200)
strcpy() is deprecated; use strscpy() instead.

No functional changes intended.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20250512105754.35595-2-thorsten.blum@linux.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/isa/sb/emu8000.c
sound/isa/sb/jazz16.c
sound/isa/sb/sb16.c
sound/isa/sb/sb8.c
sound/isa/sb/sb8_midi.c
sound/isa/sb/sb_mixer.c

index 52884e6b9193ade0830e1868a42cf994bd487d21..312b217491d4ecfd17595969922e5b44b9e09f3a 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/export.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/string.h>
 #include <sound/core.h>
 #include <sound/emu8000.h>
 #include <sound/emu8000_reg.h>
@@ -1096,7 +1097,7 @@ snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports,
 #if IS_ENABLED(CONFIG_SND_SEQUENCER)
        if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000,
                               sizeof(struct snd_emu8000*), &awe) >= 0) {
-               strcpy(awe->name, "EMU-8000");
+               strscpy(awe->name, "EMU-8000");
                *(struct snd_emu8000 **)SNDRV_SEQ_DEVICE_ARGPTR(awe) = hw;
        }
 #else
index b28490973892f06b32d4c966629d4acc8d60562f..69d9bfb6c14c617d81f49fa07d02f060e0a9a700 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/delay.h>
+#include <linux/string.h>
 #include <asm/dma.h>
 #include <linux/isa.h>
 #include <sound/core.h>
@@ -286,8 +287,8 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
 
        jazz16->chip = chip;
 
-       strcpy(card->driver, "jazz16");
-       strcpy(card->shortname, "Media Vision Jazz16");
+       strscpy(card->driver, "jazz16");
+       strscpy(card->shortname, "Media Vision Jazz16");
        sprintf(card->longname,
                "Media Vision Jazz16 at 0x%lx, irq %d, dma8 %d, dma16 %d",
                port[dev], xirq, xdma8, xdma16);
index 2f7505ad855c4581bfb4cd45ca1be30b6ff59bbd..75276211733833f273dcd80f4608630cded4de9e 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/err.h>
 #include <linux/isa.h>
 #include <linux/module.h>
+#include <linux/string.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/sb16_csp.h>
@@ -337,12 +338,12 @@ static int snd_sb16_probe(struct snd_card *card, int dev)
        if (err < 0)
                return err;
 
-       strcpy(card->driver,
+       strscpy(card->driver,
 #ifdef SNDRV_SBAWE_EMU8000
                        awe_port[dev] > 0 ? "SB AWE" :
 #endif
                        "SB16");
-       strcpy(card->shortname, chip->name);
+       strscpy(card->shortname, chip->name);
        sprintf(card->longname, "%s at 0x%lx, irq %i, dma ",
                chip->name,
                chip->port,
index 8726778c815eedf744a5b8e669e6eb41e0a89fe4..6d513126591318e01f7737820a72d5110c50e6e9 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/isa.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
+#include <linux/string.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/opl3.h>
@@ -162,8 +163,8 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
        if (err < 0)
                return err;
 
-       strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
-       strcpy(card->shortname, chip->name);
+       strscpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
+       strscpy(card->shortname, chip->name);
        sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
                chip->name,
                chip->port,
index d2908fc280f851d587effc88f60d1bf72c311933..57867e51d3670086e672853e575c8dd25f56d1b8 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/io.h>
+#include <linux/string.h>
 #include <linux/time.h>
 #include <sound/core.h>
 #include <sound/sb.h>
@@ -254,7 +255,7 @@ int snd_sb8dsp_midi(struct snd_sb *chip, int device)
        err = snd_rawmidi_new(chip->card, "SB8 MIDI", device, 1, 1, &rmidi);
        if (err < 0)
                return err;
-       strcpy(rmidi->name, "SB8 MIDI");
+       strscpy(rmidi->name, "SB8 MIDI");
        snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_sb8dsp_midi_output);
        snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_sb8dsp_midi_input);
        rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT;
index 9d23b7a4570bf346269699e7a2da622ca87932d2..b2709ed134b4a4a7c35ace38c7616c268ae70fc9 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <linux/io.h>
 #include <linux/delay.h>
+#include <linux/string.h>
 #include <linux/time.h>
 #include <sound/core.h>
 #include <sound/sb.h>
@@ -718,7 +719,7 @@ static int snd_sbmixer_init(struct snd_sb *chip,
                        return err;
        }
        snd_component_add(card, name);
-       strcpy(card->mixername, name);
+       strscpy(card->mixername, name);
        return 0;
 }
 
@@ -799,7 +800,7 @@ int snd_sbmixer_new(struct snd_sb *chip)
                        return err;
                break;
        default:
-               strcpy(card->mixername, "???");
+               strscpy(card->mixername, "???");
        }
        return 0;
 }