Skip to content

Commit e088806

Browse files
tobluxtiwai
authored andcommitted
ALSA: sb: Replace deprecated strcpy() with strscpy()
strcpy() is deprecated; use strscpy() instead. No functional changes intended. Link: KSPP#88 Signed-off-by: Thorsten Blum <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 174d966 commit e088806

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

sound/isa/sb/emu8000.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/export.h>
1515
#include <linux/delay.h>
1616
#include <linux/io.h>
17+
#include <linux/string.h>
1718
#include <sound/core.h>
1819
#include <sound/emu8000.h>
1920
#include <sound/emu8000_reg.h>
@@ -1096,7 +1097,7 @@ snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports,
10961097
#if IS_ENABLED(CONFIG_SND_SEQUENCER)
10971098
if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000,
10981099
sizeof(struct snd_emu8000*), &awe) >= 0) {
1099-
strcpy(awe->name, "EMU-8000");
1100+
strscpy(awe->name, "EMU-8000");
11001101
*(struct snd_emu8000 **)SNDRV_SEQ_DEVICE_ARGPTR(awe) = hw;
11011102
}
11021103
#else

sound/isa/sb/jazz16.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/module.h>
1616
#include <linux/io.h>
1717
#include <linux/delay.h>
18+
#include <linux/string.h>
1819
#include <asm/dma.h>
1920
#include <linux/isa.h>
2021
#include <sound/core.h>
@@ -286,8 +287,8 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
286287

287288
jazz16->chip = chip;
288289

289-
strcpy(card->driver, "jazz16");
290-
strcpy(card->shortname, "Media Vision Jazz16");
290+
strscpy(card->driver, "jazz16");
291+
strscpy(card->shortname, "Media Vision Jazz16");
291292
sprintf(card->longname,
292293
"Media Vision Jazz16 at 0x%lx, irq %d, dma8 %d, dma16 %d",
293294
port[dev], xirq, xdma8, xdma16);

sound/isa/sb/sb16.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/err.h>
1111
#include <linux/isa.h>
1212
#include <linux/module.h>
13+
#include <linux/string.h>
1314
#include <sound/core.h>
1415
#include <sound/sb.h>
1516
#include <sound/sb16_csp.h>
@@ -337,12 +338,12 @@ static int snd_sb16_probe(struct snd_card *card, int dev)
337338
if (err < 0)
338339
return err;
339340

340-
strcpy(card->driver,
341+
strscpy(card->driver,
341342
#ifdef SNDRV_SBAWE_EMU8000
342343
awe_port[dev] > 0 ? "SB AWE" :
343344
#endif
344345
"SB16");
345-
strcpy(card->shortname, chip->name);
346+
strscpy(card->shortname, chip->name);
346347
sprintf(card->longname, "%s at 0x%lx, irq %i, dma ",
347348
chip->name,
348349
chip->port,

sound/isa/sb/sb8.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/isa.h>
1010
#include <linux/ioport.h>
1111
#include <linux/module.h>
12+
#include <linux/string.h>
1213
#include <sound/core.h>
1314
#include <sound/sb.h>
1415
#include <sound/opl3.h>
@@ -162,8 +163,8 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
162163
if (err < 0)
163164
return err;
164165

165-
strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
166-
strcpy(card->shortname, chip->name);
166+
strscpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
167+
strscpy(card->shortname, chip->name);
167168
sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
168169
chip->name,
169170
chip->port,

sound/isa/sb/sb8_midi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
#include <linux/io.h>
17+
#include <linux/string.h>
1718
#include <linux/time.h>
1819
#include <sound/core.h>
1920
#include <sound/sb.h>
@@ -254,7 +255,7 @@ int snd_sb8dsp_midi(struct snd_sb *chip, int device)
254255
err = snd_rawmidi_new(chip->card, "SB8 MIDI", device, 1, 1, &rmidi);
255256
if (err < 0)
256257
return err;
257-
strcpy(rmidi->name, "SB8 MIDI");
258+
strscpy(rmidi->name, "SB8 MIDI");
258259
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_sb8dsp_midi_output);
259260
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_sb8dsp_midi_input);
260261
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT;

sound/isa/sb/sb_mixer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <linux/io.h>
88
#include <linux/delay.h>
9+
#include <linux/string.h>
910
#include <linux/time.h>
1011
#include <sound/core.h>
1112
#include <sound/sb.h>
@@ -718,7 +719,7 @@ static int snd_sbmixer_init(struct snd_sb *chip,
718719
return err;
719720
}
720721
snd_component_add(card, name);
721-
strcpy(card->mixername, name);
722+
strscpy(card->mixername, name);
722723
return 0;
723724
}
724725

@@ -799,7 +800,7 @@ int snd_sbmixer_new(struct snd_sb *chip)
799800
return err;
800801
break;
801802
default:
802-
strcpy(card->mixername, "???");
803+
strscpy(card->mixername, "???");
803804
}
804805
return 0;
805806
}

0 commit comments

Comments
 (0)