* [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy()
@ 2025-07-10 10:05 Takashi Iwai
2025-07-10 10:05 ` [PATCH 001/103] ALSA: control: " Takashi Iwai
` (103 more replies)
0 siblings, 104 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
Hi,
this is a collection of small and pretty trivial patches to replace
the strcpy() calls with strscpy(). Most of changes (except for a few
last ones) are systematic replacement with strscpy() where the copy is
done against arrays, so pretty safe.
Takashi
===
Takashi Iwai (103):
ALSA: control: Use safer strscpy() instead of strcpy()
ALSA: rawmidi: Use safer strscpy() instead of strcpy()
ALSA: seq: Use safer strscpy() instead of strcpy()
ALSA: mpu401: Use safer strscpy() instead of strcpy()
ALSA: opl3: Use safer strscpy() instead of strcpy()
ALSA: opl4: Use safer strscpy() instead of strcpy()
ALSA: pcsp: Use safer strscpy() instead of strcpy()
ALSA: portman2x4: Use safer strscpy() instead of strcpy()
ALSA: serial-generic: Use safer strscpy() instead of strcpy()
ALSA: serial-u16550: Use safer strscpy() instead of strcpy()
ALSA: virmidi: Use safer strscpy() instead of strcpy()
ALSA: vx: Use safer strscpy() instead of strcpy()
ALSA: firewire: bebob: Use safer strscpy() instead of strcpy()
ALSA: firewire: dice: Use safer strscpy() instead of strcpy()
ALSA: firewire: digi00x: Use safer strscpy() instead of strcpy()
ALSA: firewire: fireface: Use safer strscpy() instead of strcpy()
ALSA: firewire: fireworks: Use safer strscpy() instead of strcpy()
ALSA: firewire: isight: Use safer strscpy() instead of strcpy()
ALSA: firewire: motu: Use safer strscpy() instead of strcpy()
ALSA: firewire: oxfw: Use safer strscpy() instead of strcpy()
ALSA: firewire: tascam: Use safer strscpy() instead of strcpy()
ALSA: ad1816a: Use safer strscpy() instead of strcpy()
ALSA: adlib: Use safer strscpy() instead of strcpy()
ALSA: als100: Use safer strscpy() instead of strcpy()
ALSA: cmi8328: Use safer strscpy() instead of strcpy()
ALSA: cmi8330: Use safer strscpy() instead of strcpy()
ALSA: cs423x: Use safer strscpy() instead of strcpy()
ALSA: es1688: Use safer strscpy() instead of strcpy()
ALSA: es18xx: Use safer strscpy() instead of strcpy()
ALSA: galaxy: Use safer strscpy() instead of strcpy()
ALSA: gus: Use safer strscpy() instead of strcpy()
ALSA: msnd: Use safer strscpy() instead of strcpy()
ALSA: opl3sa2: Use safer strscpy() instead of strcpy()
ALSA: opti9xx: Use safer strscpy() instead of strcpy()
ALSA: sc6000: Use safer strscpy() instead of strcpy()
ALSA: sscape: Use safer strscpy() instead of strcpy()
ALSA: wavefront: Use safer strscpy() instead of strcpy()
ALSA: wss: Use safer strscpy() instead of strcpy()
ALSA: mips: Use safer strscpy() instead of strcpy()
ALSA: parisc: Use safer strscpy() instead of strcpy()
ALSA: ac97: Use safer strscpy() instead of strcpy()
ALSA: ad1889: Use safer strscpy() instead of strcpy()
ALSA: ak4531: Use safer strscpy() instead of strcpy()
ALSA: ali5451: Use safer strscpy() instead of strcpy()
ALSA: als300: Use safer strscpy() instead of strcpy()
ALSA: als4000: Use safer strscpy() instead of strcpy()
ALSA: asihpi: Use safer strscpy() instead of strcpy()
ALSA: atiixp: Use safer strscpy() instead of strcpy()
ALSA: au88x0: Use safer strscpy() instead of strcpy()
ALSA: aw2: Use safer strscpy() instead of strcpy()
ALSA: azt3328: Use safer strscpy() instead of strcpy()
ALSA: bt87x: Use safer strscpy() instead of strcpy()
ALSA: ca0106: Use safer strscpy() instead of strcpy()
ALSA: cmipci: Use safer strscpy() instead of strcpy()
ALSA: cs4281: Use safer strscpy() instead of strcpy()
ALSA: cs46xx: Use safer strscpy() instead of strcpy()
ALSA: cs5530: Use safer strscpy() instead of strcpy()
ALSA: cs5535audio: Use safer strscpy() instead of strcpy()
ALSA: ctxfi: Use safer strscpy() instead of strcpy()
ALSA: echoaudio: Use safer strscpy() instead of strcpy()
ALSA: emu10k1: Use safer strscpy() instead of strcpy()
ALSA: ens1370: Use safer strscpy() instead of strcpy()
ALSA: es1938: Use safer strscpy() instead of strcpy()
ALSA: es1968: Use safer strscpy() instead of strcpy()
ALSA: fm801: Use safer strscpy() instead of strcpy()
ALSA: ice1712: Use safer strscpy() instead of strcpy()
ALSA: ice1724: Use safer strscpy() instead of strcpy()
ALSA: intel8x0: Use safer strscpy() instead of strcpy()
ALSA: korg1212: Use safer strscpy() instead of strcpy()
ALSA: lola: Use safer strscpy() instead of strcpy()
ALSA: lx6464es: Use safer strscpy() instead of strcpy()
ALSA: maestro3: Use safer strscpy() instead of strcpy()
ALSA: mixart: Use safer strscpy() instead of strcpy()
ALSA: nm256: Use safer strscpy() instead of strcpy()
ALSA: oxygen: Use safer strscpy() instead of strcpy()
ALSA: pcxhr: Use safer strscpy() instead of strcpy()
ALSA: riptide: Use safer strscpy() instead of strcpy()
ALSA: rme32: Use safer strscpy() instead of strcpy()
ALSA: rme96: Use safer strscpy() instead of strcpy()
ALSA: hdsp: Use safer strscpy() instead of strcpy()
ALSA: hdspm: Use safer strscpy() instead of strcpy()
ALSA: rme9652: Use safer strscpy() instead of strcpy()
ALSA: Use safer strscpy() instead of strcpy()
ALSA: sonicvibes: Use safer strscpy() instead of strcpy()
ALSA: trident: Use safer strscpy() instead of strcpy()
ALSA: via82xx: Use safer strscpy() instead of strcpy()
ALSA: ymfpci: Use safer strscpy() instead of strcpy()
ALSA: pdaudiocf: Use safer strscpy() instead of strcpy()
ALSA: vxpocket: Use safer strscpy() instead of strcpy()
ALSA: ppc: Use safer strscpy() instead of strcpy()
ALSA: sh: Use safer strscpy() instead of strcpy()
ALSA: sparc: Use safer strscpy() instead of strcpy()
ALSA: spi: Use safer strscpy() instead of strcpy()
ALSA: synth: Use safer strscpy() instead of strcpy()
ALSA: 6fire: Use safer strscpy() instead of strcpy()
ALSA: line6: Use safer strscpy() instead of strcpy()
ALSA: usx2y: Use safer strscpy() instead of strcpy()
ALSA: ua101: Use safer strscpy() instead of strcpy()
ALSA: usb-audio: Use safer strscpy() instead of strcpy()
ALSA: ac97: Copy string more safely
ALSA: cmipci: Copy string more safely
ALSA: usb-audio: Copy string more safely
ALSA: core: Copy string more safely
sound/core/control.c | 2 +-
sound/core/init.c | 16 +++++-----
sound/core/rawmidi.c | 6 ++--
sound/core/seq/oss/seq_oss_init.c | 4 +--
sound/core/seq/seq_clientmgr.c | 2 +-
sound/core/seq/seq_midi.c | 2 +-
sound/core/seq/seq_system.c | 4 +--
sound/core/seq/seq_ump_client.c | 2 +-
sound/core/seq/seq_virmidi.c | 2 +-
sound/drivers/mpu401/mpu401.c | 4 +--
sound/drivers/opl3/opl3_lib.c | 14 ++++-----
sound/drivers/opl4/opl4_lib.c | 2 +-
sound/drivers/pcsp/pcsp.c | 4 +--
sound/drivers/pcsp/pcsp_lib.c | 2 +-
sound/drivers/pcsp/pcsp_mixer.c | 2 +-
sound/drivers/portman2x4.c | 6 ++--
sound/drivers/serial-generic.c | 4 +--
sound/drivers/serial-u16550.c | 6 ++--
sound/drivers/virmidi.c | 6 ++--
sound/drivers/vx/vx_core.c | 2 +-
sound/drivers/vx/vx_mixer.c | 2 +-
sound/drivers/vx/vx_pcm.c | 2 +-
sound/firewire/bebob/bebob.c | 6 ++--
sound/firewire/bebob/bebob_hwdep.c | 2 +-
sound/firewire/dice/dice-hwdep.c | 2 +-
sound/firewire/dice/dice-pcm.c | 2 +-
sound/firewire/dice/dice.c | 10 +++----
sound/firewire/digi00x/digi00x-hwdep.c | 2 +-
sound/firewire/digi00x/digi00x.c | 6 ++--
sound/firewire/fireface/ff-hwdep.c | 2 +-
sound/firewire/fireface/ff.c | 6 ++--
sound/firewire/fireworks/fireworks.c | 6 ++--
sound/firewire/fireworks/fireworks_hwdep.c | 2 +-
sound/firewire/isight.c | 8 ++---
sound/firewire/motu/motu-hwdep.c | 2 +-
sound/firewire/motu/motu-pcm.c | 2 +-
sound/firewire/motu/motu.c | 6 ++--
sound/firewire/oxfw/oxfw-hwdep.c | 2 +-
sound/firewire/oxfw/oxfw-pcm.c | 2 +-
sound/firewire/oxfw/oxfw.c | 6 ++--
sound/firewire/tascam/tascam-hwdep.c | 2 +-
sound/firewire/tascam/tascam.c | 6 ++--
sound/isa/ad1816a/ad1816a.c | 4 +--
sound/isa/ad1816a/ad1816a_lib.c | 6 ++--
sound/isa/adlib.c | 4 +--
sound/isa/als100.c | 8 ++---
sound/isa/cmi8328.c | 20 ++++++-------
sound/isa/cmi8330.c | 8 ++---
sound/isa/cs423x/cs4236.c | 2 +-
sound/isa/cs423x/cs4236_lib.c | 2 +-
sound/isa/es1688/es1688_lib.c | 4 +--
sound/isa/es18xx.c | 2 +-
sound/isa/galaxy/galaxy.c | 4 +--
sound/isa/gus/gus_main.c | 16 +++++-----
sound/isa/gus/gus_mixer.c | 2 +-
sound/isa/gus/gus_pcm.c | 2 +-
sound/isa/gus/gus_timer.c | 4 +--
sound/isa/gus/gus_uart.c | 2 +-
sound/isa/gus/gusextreme.c | 8 ++---
sound/isa/gus/gusmax.c | 16 +++++-----
sound/isa/gus/interwave.c | 34 +++++++++++-----------
sound/isa/msnd/msnd.c | 2 +-
sound/isa/msnd/msnd_pinnacle.c | 22 +++++++-------
sound/isa/msnd/msnd_pinnacle_mixer.c | 2 +-
sound/isa/opl3sa2.c | 20 ++++++-------
sound/isa/opti9xx/miro.c | 8 ++---
sound/isa/opti9xx/opti92x-ad1848.c | 18 ++++++------
sound/isa/sc6000.c | 20 ++++++-------
sound/isa/sscape.c | 4 +--
sound/isa/wavefront/wavefront.c | 16 +++++-----
sound/isa/wss/wss_lib.c | 6 ++--
sound/mips/hal2.c | 6 ++--
sound/parisc/harmony.c | 8 ++---
sound/pci/ac97/ac97_codec.c | 23 ++++++++-------
sound/pci/ac97/ac97_local.h | 2 +-
sound/pci/ac97/ac97_patch.c | 8 ++---
sound/pci/ac97/ac97_proc.c | 2 +-
sound/pci/ad1889.c | 6 ++--
sound/pci/ak4531_codec.c | 2 +-
sound/pci/ali5451/ali5451.c | 6 ++--
sound/pci/als300.c | 4 +--
sound/pci/als4000.c | 4 +--
sound/pci/asihpi/asihpi.c | 10 +++----
sound/pci/asihpi/hpi6000.c | 2 +-
sound/pci/atiixp.c | 10 +++----
sound/pci/atiixp_modem.c | 6 ++--
sound/pci/au88x0/au88x0.c | 4 +--
sound/pci/au88x0/au88x0_mixer.c | 2 +-
sound/pci/aw2/aw2-alsa.c | 10 +++----
sound/pci/azt3328.c | 12 ++++----
sound/pci/bt87x.c | 6 ++--
sound/pci/ca0106/ca0106_main.c | 6 ++--
sound/pci/ca0106/ca0106_mixer.c | 4 +--
sound/pci/ca0106/ca_midi.c | 2 +-
sound/pci/cmipci.c | 25 ++++++++--------
sound/pci/cs4281.c | 8 ++---
sound/pci/cs46xx/cs46xx.c | 4 +--
sound/pci/cs46xx/cs46xx_lib.c | 20 ++++++-------
sound/pci/cs46xx/dsp_spos.c | 8 ++---
sound/pci/cs5530.c | 4 +--
sound/pci/cs5535audio/cs5535audio.c | 4 +--
sound/pci/cs5535audio/cs5535audio_pcm.c | 2 +-
sound/pci/ctxfi/ctmixer.c | 2 +-
sound/pci/echoaudio/midi.c | 2 +-
sound/pci/emu10k1/emumpu401.c | 2 +-
sound/pci/emu10k1/emupcm.c | 10 +++----
sound/pci/emu10k1/p16v.c | 2 +-
sound/pci/emu10k1/timer.c | 2 +-
sound/pci/ens1370.c | 10 +++----
sound/pci/es1938.c | 8 ++---
sound/pci/es1968.c | 14 ++++-----
sound/pci/fm801.c | 6 ++--
sound/pci/ice1712/ice1712.c | 14 ++++-----
sound/pci/ice1712/ice1724.c | 18 ++++++------
sound/pci/intel8x0.c | 14 ++++-----
sound/pci/intel8x0m.c | 10 +++----
sound/pci/korg1212/korg1212.c | 6 ++--
sound/pci/lola/lola.c | 4 +--
sound/pci/lx6464es/lx6464es.c | 4 +--
sound/pci/maestro3.c | 8 ++---
sound/pci/mixart/mixart.c | 6 ++--
sound/pci/nm256/nm256.c | 6 ++--
sound/pci/oxygen/oxygen_lib.c | 6 ++--
sound/pci/oxygen/oxygen_pcm.c | 8 ++---
sound/pci/pcxhr/pcxhr.c | 4 +--
sound/pci/riptide/riptide.c | 6 ++--
sound/pci/rme32.c | 12 ++++----
sound/pci/rme96.c | 16 +++++-----
sound/pci/rme9652/hdsp.c | 12 ++++----
sound/pci/rme9652/hdspm.c | 8 ++---
sound/pci/rme9652/rme9652.c | 12 ++++----
sound/pci/sis7019.c | 6 ++--
sound/pci/sonicvibes.c | 8 ++---
sound/pci/trident/trident.c | 6 ++--
sound/pci/trident/trident_main.c | 14 ++++-----
sound/pci/via82xx.c | 20 ++++++-------
sound/pci/via82xx_modem.c | 4 +--
sound/pci/ymfpci/ymfpci.c | 2 +-
sound/pci/ymfpci/ymfpci_main.c | 8 ++---
sound/pcmcia/pdaudiocf/pdaudiocf.c | 2 +-
sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 2 +-
sound/pcmcia/vx/vxpocket.c | 2 +-
sound/ppc/awacs.c | 2 +-
sound/ppc/burgundy.c | 2 +-
sound/ppc/daca.c | 2 +-
sound/ppc/pmac.c | 2 +-
sound/ppc/powermac.c | 8 ++---
sound/ppc/snd_ps3.c | 8 ++---
sound/sh/aica.c | 8 ++---
sound/sh/sh_dac_audio.c | 6 ++--
sound/sparc/cs4231.c | 14 ++++-----
sound/spi/at73c213.c | 8 ++---
sound/synth/emux/emux_hwdep.c | 2 +-
sound/synth/emux/emux_oss.c | 2 +-
sound/usb/6fire/chip.c | 4 +--
sound/usb/6fire/midi.c | 2 +-
sound/usb/6fire/pcm.c | 2 +-
sound/usb/card.c | 13 +++++----
sound/usb/line6/driver.c | 8 ++---
sound/usb/line6/midi.c | 4 +--
sound/usb/line6/pcm.c | 2 +-
sound/usb/line6/toneport.c | 2 +-
sound/usb/midi.c | 2 +-
sound/usb/midi2.c | 3 +-
sound/usb/misc/ua101.c | 6 ++--
sound/usb/mixer.c | 24 +++++++--------
sound/usb/mixer_scarlett.c | 31 +++++++++++---------
sound/usb/mixer_scarlett2.c | 14 +++++----
sound/usb/proc.c | 2 +-
sound/usb/stream.c | 5 ++--
sound/usb/usx2y/us122l.c | 2 +-
sound/usb/usx2y/usX2Yhwdep.c | 2 +-
sound/usb/usx2y/usbusx2y.c | 2 +-
173 files changed, 588 insertions(+), 576 deletions(-)
--
2.50.0
^ permalink raw reply [flat|nested] 112+ messages in thread
* [PATCH 001/103] ALSA: control: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 002/103] ALSA: rawmidi: " Takashi Iwai
` (102 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/core/control.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/control.c b/sound/core/control.c
index 11f660fc6f2b..9c3fd5113a61 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1435,7 +1435,7 @@ static int snd_ctl_elem_user_enum_info(struct snd_kcontrol *kcontrol,
names = ue->priv_data;
for (; item > 0; --item)
names += strlen(names) + 1;
- strcpy(uinfo->value.enumerated.name, names);
+ strscpy(uinfo->value.enumerated.name, names);
return 0;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 002/103] ALSA: rawmidi: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
2025-07-10 10:05 ` [PATCH 001/103] ALSA: control: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 003/103] ALSA: seq: " Takashi Iwai
` (101 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/core/rawmidi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 70a958ac1112..20d36a346cca 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -631,9 +631,9 @@ static int snd_rawmidi_info(struct snd_rawmidi_substream *substream,
info->flags = rmidi->info_flags;
if (substream->inactive)
info->flags |= SNDRV_RAWMIDI_INFO_STREAM_INACTIVE;
- strcpy(info->id, rmidi->id);
- strcpy(info->name, rmidi->name);
- strcpy(info->subname, substream->name);
+ strscpy(info->id, rmidi->id);
+ strscpy(info->name, rmidi->name);
+ strscpy(info->subname, substream->name);
info->subdevices_count = substream->pstr->substream_count;
info->subdevices_avail = (substream->pstr->substream_count -
substream->pstr->substream_opened);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 003/103] ALSA: seq: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
2025-07-10 10:05 ` [PATCH 001/103] ALSA: control: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 002/103] ALSA: rawmidi: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 004/103] ALSA: mpu401: " Takashi Iwai
` (100 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/core/seq/oss/seq_oss_init.c | 4 ++--
sound/core/seq/seq_clientmgr.c | 2 +-
sound/core/seq/seq_midi.c | 2 +-
sound/core/seq/seq_system.c | 4 ++--
sound/core/seq/seq_ump_client.c | 2 +-
sound/core/seq/seq_virmidi.c | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index e6d7d83ed0e7..973f057eb731 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -79,7 +79,7 @@ snd_seq_oss_create_client(void)
system_client = rc;
/* create announcement receiver port */
- strcpy(port->name, "Receiver");
+ strscpy(port->name, "Receiver");
port->addr.client = system_client;
port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */
port->type = 0;
@@ -347,7 +347,7 @@ alloc_seq_queue(struct seq_oss_devinfo *dp)
memset(&qinfo, 0, sizeof(qinfo));
qinfo.owner = system_client;
qinfo.locked = 1;
- strcpy(qinfo.name, "OSS Sequencer Emulation");
+ strscpy(qinfo.name, "OSS Sequencer Emulation");
rc = call_ctl(SNDRV_SEQ_IOCTL_CREATE_QUEUE, &qinfo);
if (rc < 0)
return rc;
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 880240924bfd..aa9c956d2581 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1256,7 +1256,7 @@ static void get_client_info(struct snd_seq_client *cptr,
/* fill the info fields */
info->type = cptr->type;
- strcpy(info->name, cptr->name);
+ strscpy(info->name, cptr->name);
info->filter = cptr->filter;
info->event_lost = cptr->event_lost;
memcpy(info->event_filter, cptr->event_filter, 32);
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
index ba52a77eda38..581e138a3115 100644
--- a/sound/core/seq/seq_midi.c
+++ b/sound/core/seq/seq_midi.c
@@ -344,7 +344,7 @@ snd_seq_midisynth_probe(struct device *_dev)
info->stream = SNDRV_RAWMIDI_STREAM_INPUT;
info->subdevice = p;
if (snd_rawmidi_info_select(card, info) >= 0)
- strcpy(port->name, info->subname);
+ strscpy(port->name, info->subname);
if (! port->name[0]) {
if (info->name[0]) {
if (ports > 1)
diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c
index 853920f79016..5b5603e5970b 100644
--- a/sound/core/seq/seq_system.c
+++ b/sound/core/seq/seq_system.c
@@ -146,7 +146,7 @@ int __init snd_seq_system_client_init(void)
}
/* register timer */
- strcpy(port->name, "Timer");
+ strscpy(port->name, "Timer");
port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* accept queue control */
port->capability |= SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ; /* for broadcast */
port->kernel = &pcallbacks;
@@ -160,7 +160,7 @@ int __init snd_seq_system_client_init(void)
goto error_port;
/* register announcement port */
- strcpy(port->name, "Announce");
+ strscpy(port->name, "Announce");
port->capability = SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ; /* for broadcast only */
pcallbacks.event_input = NULL;
pcallbacks.subscribe = sys_announce_subscribe;
diff --git a/sound/core/seq/seq_ump_client.c b/sound/core/seq/seq_ump_client.c
index 1255351b59ce..27247babb16d 100644
--- a/sound/core/seq/seq_ump_client.c
+++ b/sound/core/seq/seq_ump_client.c
@@ -310,7 +310,7 @@ static int create_ump_endpoint_port(struct seq_ump_client *client)
SNDRV_SEQ_PORT_TYPE_HARDWARE |
SNDRV_SEQ_PORT_TYPE_PORT;
port->midi_channels = 16;
- strcpy(port->name, "MIDI 2.0");
+ strscpy(port->name, "MIDI 2.0");
memset(&pcallbacks, 0, sizeof(pcallbacks));
pcallbacks.owner = THIS_MODULE;
pcallbacks.private_data = client;
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index b4672613c261..9e7fd4993a10 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -497,7 +497,7 @@ int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmi
&rmidi);
if (err < 0)
return err;
- strcpy(rmidi->name, rmidi->id);
+ strscpy(rmidi->name, rmidi->id);
rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
if (rdev == NULL) {
snd_device_free(card, rmidi);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 004/103] ALSA: mpu401: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (2 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 003/103] ALSA: seq: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 005/103] ALSA: opl3: " Takashi Iwai
` (99 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/drivers/mpu401/mpu401.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index cd01af5fa4ed..d3f9424088d4 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -63,8 +63,8 @@ static int snd_mpu401_create(struct device *devptr, int dev,
0, &card);
if (err < 0)
return err;
- strcpy(card->driver, "MPU-401 UART");
- strcpy(card->shortname, card->driver);
+ strscpy(card->driver, "MPU-401 UART");
+ strscpy(card->shortname, card->driver);
sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]);
if (irq[dev] >= 0) {
sprintf(card->longname + strlen(card->longname), "irq %d", irq[dev]);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 005/103] ALSA: opl3: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (3 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 004/103] ALSA: mpu401: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 006/103] ALSA: opl4: " Takashi Iwai
` (98 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/drivers/opl3/opl3_lib.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c
index 4e57e3b2f118..cd9642a6689b 100644
--- a/sound/drivers/opl3/opl3_lib.c
+++ b/sound/drivers/opl3/opl3_lib.c
@@ -245,7 +245,7 @@ static int snd_opl3_timer1_init(struct snd_opl3 * opl3, int timer_no)
tid.subdevice = 0;
err = snd_timer_new(opl3->card, "AdLib timer #1", &tid, &timer);
if (err >= 0) {
- strcpy(timer->name, "AdLib timer #1");
+ strscpy(timer->name, "AdLib timer #1");
timer->private_data = opl3;
timer->hw = snd_opl3_timer1;
}
@@ -266,7 +266,7 @@ static int snd_opl3_timer2_init(struct snd_opl3 * opl3, int timer_no)
tid.subdevice = 0;
err = snd_timer_new(opl3->card, "AdLib timer #2", &tid, &timer);
if (err >= 0) {
- strcpy(timer->name, "AdLib timer #2");
+ strscpy(timer->name, "AdLib timer #2");
timer->private_data = opl3;
timer->hw = snd_opl3_timer2;
}
@@ -497,18 +497,18 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3,
if (device == 0)
hw->oss_type = SNDRV_OSS_DEVICE_TYPE_DMFM;
#endif
- strcpy(hw->name, hw->id);
+ strscpy(hw->name, hw->id);
switch (opl3->hardware & OPL3_HW_MASK) {
case OPL3_HW_OPL2:
- strcpy(hw->name, "OPL2 FM");
+ strscpy(hw->name, "OPL2 FM");
hw->iface = SNDRV_HWDEP_IFACE_OPL2;
break;
case OPL3_HW_OPL3:
- strcpy(hw->name, "OPL3 FM");
+ strscpy(hw->name, "OPL3 FM");
hw->iface = SNDRV_HWDEP_IFACE_OPL3;
break;
case OPL3_HW_OPL4:
- strcpy(hw->name, "OPL4 FM");
+ strscpy(hw->name, "OPL4 FM");
hw->iface = SNDRV_HWDEP_IFACE_OPL4;
break;
}
@@ -524,7 +524,7 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3,
#if IS_ENABLED(CONFIG_SND_SEQUENCER)
if (snd_seq_device_new(card, seq_device, SNDRV_SEQ_DEV_ID_OPL3,
sizeof(struct snd_opl3 *), &opl3->seq_dev) >= 0) {
- strcpy(opl3->seq_dev->name, hw->name);
+ strscpy(opl3->seq_dev->name, hw->name);
*(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(opl3->seq_dev) = opl3;
}
#endif
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 006/103] ALSA: opl4: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (4 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 005/103] ALSA: opl3: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 007/103] ALSA: pcsp: " Takashi Iwai
` (97 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/drivers/opl4/opl4_lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/drivers/opl4/opl4_lib.c b/sound/drivers/opl4/opl4_lib.c
index 8fa61596875a..ef6b2d533958 100644
--- a/sound/drivers/opl4/opl4_lib.c
+++ b/sound/drivers/opl4/opl4_lib.c
@@ -152,7 +152,7 @@ static int snd_opl4_create_seq_dev(struct snd_opl4 *opl4, int seq_device)
opl4->seq_dev_num = seq_device;
if (snd_seq_device_new(opl4->card, seq_device, SNDRV_SEQ_DEV_ID_OPL4,
sizeof(struct snd_opl4 *), &opl4->seq_dev) >= 0) {
- strcpy(opl4->seq_dev->name, "OPL4 Wavetable");
+ strscpy(opl4->seq_dev->name, "OPL4 Wavetable");
*(struct snd_opl4 **)SNDRV_SEQ_DEVICE_ARGPTR(opl4->seq_dev) = opl4;
opl4->seq_dev->private_data = opl4;
opl4->seq_dev->private_free = snd_opl4_seq_dev_free;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 007/103] ALSA: pcsp: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (5 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 006/103] ALSA: opl4: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 008/103] ALSA: portman2x4: " Takashi Iwai
` (96 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/drivers/pcsp/pcsp.c | 4 ++--
sound/drivers/pcsp/pcsp_lib.c | 2 +-
sound/drivers/pcsp/pcsp_mixer.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index e8482c2290c3..ff6bb375c900 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -122,8 +122,8 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev)
if (err < 0)
return err;
- strcpy(card->driver, "PC-Speaker");
- strcpy(card->shortname, "pcsp");
+ strscpy(card->driver, "PC-Speaker");
+ strscpy(card->shortname, "pcsp");
sprintf(card->longname, "Internal PC-Speaker at port 0x%x",
pcsp_chip.port);
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c
index d9bc1ea1b53c..80b313f4fcd3 100644
--- a/sound/drivers/pcsp/pcsp_lib.c
+++ b/sound/drivers/pcsp/pcsp_lib.c
@@ -340,7 +340,7 @@ int snd_pcsp_new_pcm(struct snd_pcsp *chip)
chip->pcm->private_data = chip;
chip->pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
- strcpy(chip->pcm->name, "pcsp");
+ strscpy(chip->pcm->name, "pcsp");
snd_pcm_set_managed_buffer_all(chip->pcm,
SNDRV_DMA_TYPE_CONTINUOUS,
diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c
index c0ae942358b9..27d6150329a8 100644
--- a/sound/drivers/pcsp/pcsp_mixer.c
+++ b/sound/drivers/pcsp/pcsp_mixer.c
@@ -158,7 +158,7 @@ int snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm)
if (err < 0)
return err;
- strcpy(card->mixername, "PC-Speaker");
+ strscpy(card->mixername, "PC-Speaker");
return 0;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 008/103] ALSA: portman2x4: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (6 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 007/103] ALSA: pcsp: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 009/103] ALSA: serial-generic: " Takashi Iwai
` (95 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/drivers/portman2x4.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index 5e4ef25a83a4..b4fa6625a3d6 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -549,7 +549,7 @@ static int snd_portman_rawmidi_create(struct snd_card *card)
return err;
rmidi->private_data = pm;
- strcpy(rmidi->name, CARD_NAME);
+ strscpy(rmidi->name, CARD_NAME);
rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT |
SNDRV_RAWMIDI_INFO_INPUT |
SNDRV_RAWMIDI_INFO_DUPLEX;
@@ -714,8 +714,8 @@ static int snd_portman_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "Cannot create card\n");
return err;
}
- strcpy(card->driver, DRIVER_NAME);
- strcpy(card->shortname, CARD_NAME);
+ strscpy(card->driver, DRIVER_NAME);
+ strscpy(card->shortname, CARD_NAME);
sprintf(card->longname, "%s at 0x%lx, irq %i",
card->shortname, p->base, p->irq);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 009/103] ALSA: serial-generic: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (7 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 008/103] ALSA: portman2x4: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 010/103] ALSA: serial-u16550: " Takashi Iwai
` (94 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/drivers/serial-generic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/drivers/serial-generic.c b/sound/drivers/serial-generic.c
index 36409a56c675..21ae053c0576 100644
--- a/sound/drivers/serial-generic.c
+++ b/sound/drivers/serial-generic.c
@@ -300,7 +300,7 @@ static int snd_serial_generic_rmidi(struct snd_serial_generic *drvdata,
&snd_serial_generic_input);
snd_rawmidi_set_ops(rrawmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
&snd_serial_generic_output);
- strcpy(rrawmidi->name, drvdata->card->shortname);
+ strscpy(rrawmidi->name, drvdata->card->shortname);
snd_serial_generic_substreams(&rrawmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT],
drvdata->serdev->ctrl->nr);
@@ -329,7 +329,7 @@ static int snd_serial_generic_probe(struct serdev_device *serdev)
if (err < 0)
return err;
- strcpy(card->driver, "SerialMIDI");
+ strscpy(card->driver, "SerialMIDI");
sprintf(card->shortname, "SerialMIDI-%d", serdev->ctrl->nr);
sprintf(card->longname, "Serial MIDI device at serial%d", serdev->ctrl->nr);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 010/103] ALSA: serial-u16550: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (8 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 009/103] ALSA: serial-generic: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 011/103] ALSA: virmidi: " Takashi Iwai
` (93 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/drivers/serial-u16550.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index 6d0656fcd574..52772ccfc377 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -845,7 +845,7 @@ static int snd_uart16550_rmidi(struct snd_uart16550 *uart, int device,
&snd_uart16550_input);
snd_rawmidi_set_ops(rrawmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
&snd_uart16550_output);
- strcpy(rrawmidi->name, "Serial MIDI");
+ strscpy(rrawmidi->name, "Serial MIDI");
snd_uart16550_substreams(&rrawmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]);
snd_uart16550_substreams(&rrawmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]);
rrawmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT |
@@ -905,8 +905,8 @@ static int snd_serial_probe(struct platform_device *devptr)
if (err < 0)
return err;
- strcpy(card->driver, "Serial");
- strcpy(card->shortname, "Serial MIDI (UART16550A)");
+ strscpy(card->driver, "Serial");
+ strscpy(card->shortname, "Serial MIDI (UART16550A)");
err = snd_uart16550_create(card, port[dev], irq[dev], speed[dev],
base[dev], adaptor[dev], droponfull[dev],
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 011/103] ALSA: virmidi: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (9 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 010/103] ALSA: serial-u16550: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 012/103] ALSA: vx: " Takashi Iwai
` (92 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/drivers/virmidi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c
index 5f7b65ad63e3..a204f42d1026 100644
--- a/sound/drivers/virmidi.c
+++ b/sound/drivers/virmidi.c
@@ -95,11 +95,11 @@ static int snd_virmidi_probe(struct platform_device *devptr)
if (err < 0)
return err;
vmidi->midi[idx] = rmidi;
- strcpy(rmidi->name, "Virtual Raw MIDI");
+ strscpy(rmidi->name, "Virtual Raw MIDI");
}
- strcpy(card->driver, "VirMIDI");
- strcpy(card->shortname, "VirMIDI");
+ strscpy(card->driver, "VirMIDI");
+ strscpy(card->shortname, "VirMIDI");
sprintf(card->longname, "Virtual MIDI Card %i", dev + 1);
err = snd_card_register(card);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 012/103] ALSA: vx: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (10 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 011/103] ALSA: virmidi: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 013/103] ALSA: firewire: bebob: " Takashi Iwai
` (91 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/drivers/vx/vx_core.c | 2 +-
sound/drivers/vx/vx_mixer.c | 2 +-
sound/drivers/vx/vx_pcm.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
index e2def8719ed2..7f25fa7c0404 100644
--- a/sound/drivers/vx/vx_core.c
+++ b/sound/drivers/vx/vx_core.c
@@ -806,7 +806,7 @@ struct vx_core *snd_vx_create(struct snd_card *card,
chip->card = card;
card->private_data = chip;
- strcpy(card->driver, hw->name);
+ strscpy(card->driver, hw->name);
sprintf(card->shortname, "Digigram %s", hw->name);
vx_proc_init(chip);
diff --git a/sound/drivers/vx/vx_mixer.c b/sound/drivers/vx/vx_mixer.c
index 53d78eb13c53..0a51ecdc084a 100644
--- a/sound/drivers/vx/vx_mixer.c
+++ b/sound/drivers/vx/vx_mixer.c
@@ -903,7 +903,7 @@ int snd_vx_mixer_new(struct vx_core *chip)
struct snd_card *card = chip->card;
char name[32];
- strcpy(card->mixername, card->driver);
+ strscpy(card->mixername, card->driver);
/* output level controls */
for (i = 0; i < chip->hw->num_outs; i++) {
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index cbc77ca1ebdd..defc489494af 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1226,7 +1226,7 @@ int snd_vx_pcm_new(struct vx_core *chip)
pcm->private_free = snd_vx_pcm_free;
pcm->info_flags = 0;
pcm->nonatomic = true;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcm[i] = pcm;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 013/103] ALSA: firewire: bebob: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (11 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 012/103] ALSA: vx: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 014/103] ALSA: firewire: dice: " Takashi Iwai
` (90 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/firewire/bebob/bebob.c | 6 +++---
sound/firewire/bebob/bebob_hwdep.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
index 2ba5962beb30..4ebaeff16455 100644
--- a/sound/firewire/bebob/bebob.c
+++ b/sound/firewire/bebob/bebob.c
@@ -105,9 +105,9 @@ name_device(struct snd_bebob *bebob)
if (err < 0)
goto end;
- strcpy(bebob->card->driver, "BeBoB");
- strcpy(bebob->card->shortname, model);
- strcpy(bebob->card->mixername, model);
+ strscpy(bebob->card->driver, "BeBoB");
+ strscpy(bebob->card->shortname, model);
+ strscpy(bebob->card->mixername, model);
snprintf(bebob->card->longname, sizeof(bebob->card->longname),
"%s %s (id:%d, rev:%d), GUID %08x%08x at %s, S%d",
vendor, model, hw_id, revision,
diff --git a/sound/firewire/bebob/bebob_hwdep.c b/sound/firewire/bebob/bebob_hwdep.c
index 6f9331655d43..5779e99a6bb2 100644
--- a/sound/firewire/bebob/bebob_hwdep.c
+++ b/sound/firewire/bebob/bebob_hwdep.c
@@ -183,7 +183,7 @@ int snd_bebob_create_hwdep_device(struct snd_bebob *bebob)
err = snd_hwdep_new(bebob->card, "BeBoB", 0, &hwdep);
if (err < 0)
goto end;
- strcpy(hwdep->name, "BeBoB");
+ strscpy(hwdep->name, "BeBoB");
hwdep->iface = SNDRV_HWDEP_IFACE_FW_BEBOB;
hwdep->ops = ops;
hwdep->private_data = bebob;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 014/103] ALSA: firewire: dice: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (12 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 013/103] ALSA: firewire: bebob: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 015/103] ALSA: firewire: digi00x: " Takashi Iwai
` (89 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/firewire/dice/dice-hwdep.c | 2 +-
sound/firewire/dice/dice-pcm.c | 2 +-
sound/firewire/dice/dice.c | 10 +++++-----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/firewire/dice/dice-hwdep.c b/sound/firewire/dice/dice-hwdep.c
index ffc0b97782d6..d165dd427bd3 100644
--- a/sound/firewire/dice/dice-hwdep.c
+++ b/sound/firewire/dice/dice-hwdep.c
@@ -179,7 +179,7 @@ int snd_dice_create_hwdep(struct snd_dice *dice)
err = snd_hwdep_new(dice->card, "DICE", 0, &hwdep);
if (err < 0)
return err;
- strcpy(hwdep->name, "DICE");
+ strscpy(hwdep->name, "DICE");
hwdep->iface = SNDRV_HWDEP_IFACE_FW_DICE;
hwdep->ops = ops;
hwdep->private_data = dice;
diff --git a/sound/firewire/dice/dice-pcm.c b/sound/firewire/dice/dice-pcm.c
index 2cf2adb48f2a..cfc19bd0d5dd 100644
--- a/sound/firewire/dice/dice-pcm.c
+++ b/sound/firewire/dice/dice-pcm.c
@@ -442,7 +442,7 @@ int snd_dice_create_pcm(struct snd_dice *dice)
return err;
pcm->private_data = dice;
pcm->nonatomic = true;
- strcpy(pcm->name, dice->card->shortname);
+ strscpy(pcm->name, dice->card->shortname);
if (capture > 0)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c
index d362e4251c68..9675ec14271d 100644
--- a/sound/firewire/dice/dice.c
+++ b/sound/firewire/dice/dice.c
@@ -102,9 +102,9 @@ static void dice_card_strings(struct snd_dice *dice)
unsigned int i;
int err;
- strcpy(card->driver, "DICE");
+ strscpy(card->driver, "DICE");
- strcpy(card->shortname, "DICE");
+ strscpy(card->shortname, "DICE");
BUILD_BUG_ON(NICK_NAME_SIZE < sizeof(card->shortname));
err = snd_dice_transaction_read_global(dice, GLOBAL_NICK_NAME,
card->shortname,
@@ -117,16 +117,16 @@ static void dice_card_strings(struct snd_dice *dice)
card->shortname[sizeof(card->shortname) - 1] = '\0';
}
- strcpy(vendor, "?");
+ strscpy(vendor, "?");
fw_csr_string(dev->config_rom + 5, CSR_VENDOR, vendor, sizeof(vendor));
- strcpy(model, "?");
+ strscpy(model, "?");
fw_csr_string(dice->unit->directory, CSR_MODEL, model, sizeof(model));
snprintf(card->longname, sizeof(card->longname),
"%s %s (serial %u) at %s, S%d",
vendor, model, dev->config_rom[4] & 0x3fffff,
dev_name(&dice->unit->device), 100 << dev->max_speed);
- strcpy(card->mixername, "DICE");
+ strscpy(card->mixername, "DICE");
}
static void dice_card_free(struct snd_card *card)
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 015/103] ALSA: firewire: digi00x: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (13 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 014/103] ALSA: firewire: dice: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 016/103] ALSA: firewire: fireface: " Takashi Iwai
` (88 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/firewire/digi00x/digi00x-hwdep.c | 2 +-
sound/firewire/digi00x/digi00x.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/firewire/digi00x/digi00x-hwdep.c b/sound/firewire/digi00x/digi00x-hwdep.c
index aadf7d724856..b150607c0a0d 100644
--- a/sound/firewire/digi00x/digi00x-hwdep.c
+++ b/sound/firewire/digi00x/digi00x-hwdep.c
@@ -188,7 +188,7 @@ int snd_dg00x_create_hwdep_device(struct snd_dg00x *dg00x)
if (err < 0)
return err;
- strcpy(hwdep->name, "Digi00x");
+ strscpy(hwdep->name, "Digi00x");
hwdep->iface = SNDRV_HWDEP_IFACE_FW_DIGI00X;
hwdep->ops = ops;
hwdep->private_data = dg00x;
diff --git a/sound/firewire/digi00x/digi00x.c b/sound/firewire/digi00x/digi00x.c
index 704ae2a5316b..cebc35dcf8cd 100644
--- a/sound/firewire/digi00x/digi00x.c
+++ b/sound/firewire/digi00x/digi00x.c
@@ -30,9 +30,9 @@ static int name_card(struct snd_dg00x *dg00x)
model = skip_spaces(name);
- strcpy(dg00x->card->driver, "Digi00x");
- strcpy(dg00x->card->shortname, model);
- strcpy(dg00x->card->mixername, model);
+ strscpy(dg00x->card->driver, "Digi00x");
+ strscpy(dg00x->card->shortname, model);
+ strscpy(dg00x->card->mixername, model);
snprintf(dg00x->card->longname, sizeof(dg00x->card->longname),
"Digidesign %s, GUID %08x%08x at %s, S%d", model,
fw_dev->config_rom[3], fw_dev->config_rom[4],
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 016/103] ALSA: firewire: fireface: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (14 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 015/103] ALSA: firewire: digi00x: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:05 ` [PATCH 017/103] ALSA: firewire: fireworks: " Takashi Iwai
` (87 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/firewire/fireface/ff-hwdep.c | 2 +-
sound/firewire/fireface/ff.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/firewire/fireface/ff-hwdep.c b/sound/firewire/fireface/ff-hwdep.c
index 8a741b3b0436..ca5c5dee71f2 100644
--- a/sound/firewire/fireface/ff-hwdep.c
+++ b/sound/firewire/fireface/ff-hwdep.c
@@ -197,7 +197,7 @@ int snd_ff_create_hwdep_devices(struct snd_ff *ff)
if (err < 0)
return err;
- strcpy(hwdep->name, ff->card->driver);
+ strscpy(hwdep->name, ff->card->driver);
hwdep->iface = SNDRV_HWDEP_IFACE_FW_FIREFACE;
hwdep->ops = hwdep_ops;
hwdep->private_data = ff;
diff --git a/sound/firewire/fireface/ff.c b/sound/firewire/fireface/ff.c
index 6e84e4787259..5d2c4fbf4434 100644
--- a/sound/firewire/fireface/ff.c
+++ b/sound/firewire/fireface/ff.c
@@ -27,9 +27,9 @@ static void name_card(struct snd_ff *ff)
name = names[ff->unit_version];
- strcpy(ff->card->driver, "Fireface");
- strcpy(ff->card->shortname, name);
- strcpy(ff->card->mixername, name);
+ strscpy(ff->card->driver, "Fireface");
+ strscpy(ff->card->shortname, name);
+ strscpy(ff->card->mixername, name);
snprintf(ff->card->longname, sizeof(ff->card->longname),
"RME %s, GUID %08x%08x at %s, S%d", name,
fw_dev->config_rom[3], fw_dev->config_rom[4],
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 017/103] ALSA: firewire: fireworks: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (15 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 016/103] ALSA: firewire: fireface: " Takashi Iwai
@ 2025-07-10 10:05 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 018/103] ALSA: firewire: isight: " Takashi Iwai
` (86 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:05 UTC (permalink / raw)
To: linux-sound
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>
---
sound/firewire/fireworks/fireworks.c | 6 +++---
sound/firewire/fireworks/fireworks_hwdep.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c
index e3ed4e094ccd..69f722244362 100644
--- a/sound/firewire/fireworks/fireworks.c
+++ b/sound/firewire/fireworks/fireworks.c
@@ -90,9 +90,9 @@ get_hardware_info(struct snd_efw *efw)
(hwinfo->arm_version >> 16) & 0xff);
efw->firmware_version = hwinfo->arm_version;
- strcpy(efw->card->driver, "Fireworks");
- strcpy(efw->card->shortname, hwinfo->model_name);
- strcpy(efw->card->mixername, hwinfo->model_name);
+ strscpy(efw->card->driver, "Fireworks");
+ strscpy(efw->card->shortname, hwinfo->model_name);
+ strscpy(efw->card->mixername, hwinfo->model_name);
scnprintf(efw->card->longname, sizeof(efw->card->longname),
"%s %s v%s, GUID %08x%08x at %s, S%d",
hwinfo->vendor_name, hwinfo->model_name, version,
diff --git a/sound/firewire/fireworks/fireworks_hwdep.c b/sound/firewire/fireworks/fireworks_hwdep.c
index 3a53914277d3..037833cd066e 100644
--- a/sound/firewire/fireworks/fireworks_hwdep.c
+++ b/sound/firewire/fireworks/fireworks_hwdep.c
@@ -319,7 +319,7 @@ int snd_efw_create_hwdep_device(struct snd_efw *efw)
err = snd_hwdep_new(efw->card, "Fireworks", 0, &hwdep);
if (err < 0)
goto end;
- strcpy(hwdep->name, "Fireworks");
+ strscpy(hwdep->name, "Fireworks");
hwdep->iface = SNDRV_HWDEP_IFACE_FW_FIREWORKS;
hwdep->ops = ops;
hwdep->private_data = efw;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 018/103] ALSA: firewire: isight: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (16 preceding siblings ...)
2025-07-10 10:05 ` [PATCH 017/103] ALSA: firewire: fireworks: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 019/103] ALSA: firewire: motu: " Takashi Iwai
` (85 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/firewire/isight.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/firewire/isight.c b/sound/firewire/isight.c
index b1e059f0d473..ee574b5d7406 100644
--- a/sound/firewire/isight.c
+++ b/sound/firewire/isight.c
@@ -455,7 +455,7 @@ static int isight_create_pcm(struct isight *isight)
return err;
pcm->private_data = isight;
pcm->nonatomic = true;
- strcpy(pcm->name, "iSight");
+ strscpy(pcm->name, "iSight");
isight->pcm = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
isight->pcm->ops = &ops;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0);
@@ -638,13 +638,13 @@ static int isight_probe(struct fw_unit *unit,
card->private_free = isight_card_free;
- strcpy(card->driver, "iSight");
- strcpy(card->shortname, "Apple iSight");
+ strscpy(card->driver, "iSight");
+ strscpy(card->shortname, "Apple iSight");
snprintf(card->longname, sizeof(card->longname),
"Apple iSight (GUID %08x%08x) at %s, S%d",
fw_dev->config_rom[3], fw_dev->config_rom[4],
dev_name(&unit->device), 100 << fw_dev->max_speed);
- strcpy(card->mixername, "iSight");
+ strscpy(card->mixername, "iSight");
err = isight_create_pcm(isight);
if (err < 0)
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 019/103] ALSA: firewire: motu: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (17 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 018/103] ALSA: firewire: isight: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 020/103] ALSA: firewire: oxfw: " Takashi Iwai
` (84 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/firewire/motu/motu-hwdep.c | 2 +-
sound/firewire/motu/motu-pcm.c | 2 +-
sound/firewire/motu/motu.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/firewire/motu/motu-hwdep.c b/sound/firewire/motu/motu-hwdep.c
index 88d1f4b56e4b..1ed60618220d 100644
--- a/sound/firewire/motu/motu-hwdep.c
+++ b/sound/firewire/motu/motu-hwdep.c
@@ -290,7 +290,7 @@ int snd_motu_create_hwdep_device(struct snd_motu *motu)
if (err < 0)
return err;
- strcpy(hwdep->name, "MOTU");
+ strscpy(hwdep->name, "MOTU");
hwdep->iface = SNDRV_HWDEP_IFACE_FW_MOTU;
hwdep->ops = ops;
hwdep->private_data = motu;
diff --git a/sound/firewire/motu/motu-pcm.c b/sound/firewire/motu/motu-pcm.c
index f3b48495acae..7b4d476af348 100644
--- a/sound/firewire/motu/motu-pcm.c
+++ b/sound/firewire/motu/motu-pcm.c
@@ -361,7 +361,7 @@ int snd_motu_create_pcm_devices(struct snd_motu *motu)
return err;
pcm->private_data = motu;
pcm->nonatomic = true;
- strcpy(pcm->name, motu->card->shortname);
+ strscpy(pcm->name, motu->card->shortname);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_ops);
diff --git a/sound/firewire/motu/motu.c b/sound/firewire/motu/motu.c
index d14ab5dd5bea..fd2a9dddbfa6 100644
--- a/sound/firewire/motu/motu.c
+++ b/sound/firewire/motu/motu.c
@@ -41,9 +41,9 @@ static void name_card(struct snd_motu *motu)
}
}
- strcpy(motu->card->driver, "FW-MOTU");
- strcpy(motu->card->shortname, motu->spec->name);
- strcpy(motu->card->mixername, motu->spec->name);
+ strscpy(motu->card->driver, "FW-MOTU");
+ strscpy(motu->card->shortname, motu->spec->name);
+ strscpy(motu->card->mixername, motu->spec->name);
snprintf(motu->card->longname, sizeof(motu->card->longname),
"MOTU %s (version:%06x), GUID %08x%08x at %s, S%d",
motu->spec->name, version,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 020/103] ALSA: firewire: oxfw: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (18 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 019/103] ALSA: firewire: motu: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 021/103] ALSA: firewire: tascam: " Takashi Iwai
` (83 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/firewire/oxfw/oxfw-hwdep.c | 2 +-
sound/firewire/oxfw/oxfw-pcm.c | 2 +-
sound/firewire/oxfw/oxfw.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/firewire/oxfw/oxfw-hwdep.c b/sound/firewire/oxfw/oxfw-hwdep.c
index a0fe99618554..3be214d8a922 100644
--- a/sound/firewire/oxfw/oxfw-hwdep.c
+++ b/sound/firewire/oxfw/oxfw-hwdep.c
@@ -177,7 +177,7 @@ int snd_oxfw_create_hwdep(struct snd_oxfw *oxfw)
err = snd_hwdep_new(oxfw->card, oxfw->card->driver, 0, &hwdep);
if (err < 0)
goto end;
- strcpy(hwdep->name, oxfw->card->driver);
+ strscpy(hwdep->name, oxfw->card->driver);
hwdep->iface = SNDRV_HWDEP_IFACE_FW_OXFW;
hwdep->ops = hwdep_ops;
hwdep->private_data = oxfw;
diff --git a/sound/firewire/oxfw/oxfw-pcm.c b/sound/firewire/oxfw/oxfw-pcm.c
index 8ca9dde54ec6..e13dc817fc28 100644
--- a/sound/firewire/oxfw/oxfw-pcm.c
+++ b/sound/firewire/oxfw/oxfw-pcm.c
@@ -441,7 +441,7 @@ int snd_oxfw_create_pcm(struct snd_oxfw *oxfw)
pcm->private_data = oxfw;
pcm->nonatomic = true;
- strcpy(pcm->name, oxfw->card->shortname);
+ strscpy(pcm->name, oxfw->card->shortname);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_ops);
if (cap > 0)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_ops);
diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
index 98ae0e8cba87..7a985f3cb8f6 100644
--- a/sound/firewire/oxfw/oxfw.c
+++ b/sound/firewire/oxfw/oxfw.c
@@ -105,9 +105,9 @@ static int name_card(struct snd_oxfw *oxfw, const struct ieee1394_device_id *ent
m = model;
}
- strcpy(oxfw->card->driver, d);
- strcpy(oxfw->card->mixername, m);
- strcpy(oxfw->card->shortname, m);
+ strscpy(oxfw->card->driver, d);
+ strscpy(oxfw->card->mixername, m);
+ strscpy(oxfw->card->shortname, m);
scnprintf(oxfw->card->longname, sizeof(oxfw->card->longname),
"%s %s (OXFW%x %04x), GUID %08x%08x at %s, S%d",
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 021/103] ALSA: firewire: tascam: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (19 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 020/103] ALSA: firewire: oxfw: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 022/103] ALSA: ad1816a: " Takashi Iwai
` (82 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/firewire/tascam/tascam-hwdep.c | 2 +-
sound/firewire/tascam/tascam.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/firewire/tascam/tascam-hwdep.c b/sound/firewire/tascam/tascam-hwdep.c
index 74eed9505665..8fc30cba29d5 100644
--- a/sound/firewire/tascam/tascam-hwdep.c
+++ b/sound/firewire/tascam/tascam-hwdep.c
@@ -265,7 +265,7 @@ int snd_tscm_create_hwdep_device(struct snd_tscm *tscm)
if (err < 0)
return err;
- strcpy(hwdep->name, "Tascam");
+ strscpy(hwdep->name, "Tascam");
hwdep->iface = SNDRV_HWDEP_IFACE_FW_TASCAM;
hwdep->ops = ops;
hwdep->private_data = tscm;
diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c
index 86880089de28..4f68bb4c58bc 100644
--- a/sound/firewire/tascam/tascam.c
+++ b/sound/firewire/tascam/tascam.c
@@ -73,9 +73,9 @@ static int identify_model(struct snd_tscm *tscm)
if (tscm->spec == NULL)
return -ENODEV;
- strcpy(tscm->card->driver, "FW-TASCAM");
- strcpy(tscm->card->shortname, model);
- strcpy(tscm->card->mixername, model);
+ strscpy(tscm->card->driver, "FW-TASCAM");
+ strscpy(tscm->card->shortname, model);
+ strscpy(tscm->card->mixername, model);
snprintf(tscm->card->longname, sizeof(tscm->card->longname),
"TASCAM %s, GUID %08x%08x at %s, S%d", model,
fw_dev->config_rom[3], fw_dev->config_rom[4],
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 022/103] ALSA: ad1816a: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (20 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 021/103] ALSA: firewire: tascam: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 023/103] ALSA: adlib: " Takashi Iwai
` (81 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/ad1816a/ad1816a.c | 4 ++--
sound/isa/ad1816a/ad1816a_lib.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index 5c9e2d41d900..8e84d4091f1e 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -143,8 +143,8 @@ static int snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard,
if (clockfreq[dev] >= 5000 && clockfreq[dev] <= 100000)
chip->clock_freq = clockfreq[dev];
- strcpy(card->driver, "AD1816A");
- strcpy(card->shortname, "ADI SoundPort AD1816A");
+ strscpy(card->driver, "AD1816A");
+ strscpy(card->shortname, "ADI SoundPort AD1816A");
sprintf(card->longname, "%s, SS at 0x%lx, irq %d, dma %d&%d",
card->shortname, chip->port, irq[dev], dma1[dev], dma2[dev]);
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c
index 2b87036cb94f..400ae547bcba 100644
--- a/sound/isa/ad1816a/ad1816a_lib.c
+++ b/sound/isa/ad1816a/ad1816a_lib.c
@@ -631,7 +631,7 @@ int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device)
pcm->private_data = chip;
pcm->info_flags = (chip->dma1 == chip->dma2 ) ? SNDRV_PCM_INFO_JOINT_DUPLEX : 0;
- strcpy(pcm->name, snd_ad1816a_chip_id(chip));
+ strscpy(pcm->name, snd_ad1816a_chip_id(chip));
snd_ad1816a_init(chip);
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, chip->card->dev,
@@ -655,7 +655,7 @@ int snd_ad1816a_timer(struct snd_ad1816a *chip, int device)
error = snd_timer_new(chip->card, "AD1816A", &tid, &timer);
if (error < 0)
return error;
- strcpy(timer->name, snd_ad1816a_chip_id(chip));
+ strscpy(timer->name, snd_ad1816a_chip_id(chip));
timer->private_data = chip;
chip->timer = timer;
timer->hw = snd_ad1816a_timer_table;
@@ -912,7 +912,7 @@ int snd_ad1816a_mixer(struct snd_ad1816a *chip)
card = chip->card;
- strcpy(card->mixername, snd_ad1816a_chip_id(chip));
+ strscpy(card->mixername, snd_ad1816a_chip_id(chip));
for (idx = 0; idx < ARRAY_SIZE(snd_ad1816a_controls); idx++) {
err = snd_ctl_add(card, snd_ctl_new1(&snd_ad1816a_controls[idx], chip));
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 023/103] ALSA: adlib: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (21 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 022/103] ALSA: ad1816a: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 024/103] ALSA: als100: " Takashi Iwai
` (80 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/adlib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c
index f079ba4ef1a0..03fb2bce9255 100644
--- a/sound/isa/adlib.c
+++ b/sound/isa/adlib.c
@@ -61,8 +61,8 @@ static int snd_adlib_probe(struct device *dev, unsigned int n)
return -EBUSY;
}
- strcpy(card->driver, DEV_NAME);
- strcpy(card->shortname, CRD_NAME);
+ strscpy(card->driver, DEV_NAME);
+ strscpy(card->shortname, CRD_NAME);
sprintf(card->longname, CRD_NAME " at %#lx", port[n]);
error = snd_opl3_create(card, port[n], port[n] + 2, OPL3_HW_AUTO, 1, &opl3);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 024/103] ALSA: als100: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (22 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 023/103] ALSA: adlib: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 025/103] ALSA: cmi8328: " Takashi Iwai
` (79 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/als100.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index e70dbf0b099a..cfc241bd252e 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -192,14 +192,14 @@ static int snd_card_als100_probe(int dev,
acard->chip = chip;
if (pid->driver_data == SB_HW_DT019X) {
- strcpy(card->driver, "DT-019X");
- strcpy(card->shortname, "Diamond Tech. DT-019X");
+ strscpy(card->driver, "DT-019X");
+ strscpy(card->shortname, "Diamond Tech. DT-019X");
snprintf(card->longname, sizeof(card->longname),
"Diamond Tech. DT-019X, %s at 0x%lx, irq %d, dma %d",
chip->name, chip->port, irq[dev], dma8[dev]);
} else {
- strcpy(card->driver, "ALS100");
- strcpy(card->shortname, "Avance Logic ALS100");
+ strscpy(card->driver, "ALS100");
+ strscpy(card->shortname, "Avance Logic ALS100");
snprintf(card->longname, sizeof(card->longname),
"Avance Logic ALS100, %s at 0x%lx, irq %d, dma %d&%d",
chip->name, chip->port, irq[dev], dma8[dev],
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 025/103] ALSA: cmi8328: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (23 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 024/103] ALSA: als100: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 026/103] ALSA: cmi8330: " Takashi Iwai
` (78 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/cmi8328.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c
index d30cce4cc7e3..4e6d823af103 100644
--- a/sound/isa/cmi8328.c
+++ b/sound/isa/cmi8328.c
@@ -155,34 +155,34 @@ static int snd_cmi8328_mixer(struct snd_wss *chip)
memset(&id2, 0, sizeof(id2));
id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
/* rename AUX0 switch to CD */
- strcpy(id1.name, "Aux Playback Switch");
- strcpy(id2.name, "CD Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch");
+ strscpy(id2.name, "CD Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "error renaming control\n");
return err;
}
/* rename AUX0 volume to CD */
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "CD Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "CD Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "error renaming control\n");
return err;
}
/* rename AUX1 switch to Synth */
- strcpy(id1.name, "Aux Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch");
id1.index = 1;
- strcpy(id2.name, "Synth Playback Switch");
+ strscpy(id2.name, "Synth Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "error renaming control\n");
return err;
}
/* rename AUX1 volume to Synth */
- strcpy(id1.name, "Aux Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
id1.index = 1;
- strcpy(id2.name, "Synth Playback Volume");
+ strscpy(id2.name, "Synth Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "error renaming control\n");
@@ -362,8 +362,8 @@ static int snd_cmi8328_probe(struct device *pdev, unsigned int ndev)
if (snd_opl3_hwdep_new(opl3, 0, 1, NULL) < 0)
dev_warn(pdev, "error initializing OPL3 hwdep\n");
- strcpy(card->driver, "CMI8328");
- strcpy(card->shortname, "C-Media CMI8328");
+ strscpy(card->driver, "CMI8328");
+ strscpy(card->shortname, "C-Media CMI8328");
sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d,%d",
card->shortname, cmi->wss->port, irq[ndev], dma1[ndev],
(dma2[ndev] >= 0) ? dma2[ndev] : dma1[ndev]);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 026/103] ALSA: cmi8330: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (24 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 025/103] ALSA: cmi8328: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 027/103] ALSA: cs423x: " Takashi Iwai
` (77 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/cmi8330.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 25b4dc181089..e681c2c82474 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -297,7 +297,7 @@ static int snd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330 *acard)
unsigned int idx;
int err;
- strcpy(card->mixername, (acard->type == CMI8329) ? "CMI8329" : "CMI8330/C3D");
+ strscpy(card->mixername, (acard->type == CMI8329) ? "CMI8329" : "CMI8330/C3D");
for (idx = 0; idx < ARRAY_SIZE(snd_cmi8330_controls); idx++) {
err = snd_ctl_add(card,
@@ -437,7 +437,7 @@ static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip)
err = snd_pcm_new(card, (chip->type == CMI8329) ? "CMI8329" : "CMI8330", 0, 1, 1, &pcm);
if (err < 0)
return err;
- strcpy(pcm->name, (chip->type == CMI8329) ? "CMI8329" : "CMI8330");
+ strscpy(pcm->name, (chip->type == CMI8329) ? "CMI8329" : "CMI8330");
pcm->private_data = chip;
/* SB16 */
@@ -590,8 +590,8 @@ static int snd_cmi8330_probe(struct snd_card *card, int dev)
mpuport[dev]);
}
- strcpy(card->driver, (acard->type == CMI8329) ? "CMI8329" : "CMI8330/C3D");
- strcpy(card->shortname, (acard->type == CMI8329) ? "C-Media CMI8329" : "C-Media CMI8330/C3D");
+ strscpy(card->driver, (acard->type == CMI8329) ? "CMI8329" : "CMI8330/C3D");
+ strscpy(card->shortname, (acard->type == CMI8329) ? "C-Media CMI8329" : "C-Media CMI8330/C3D");
sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
card->shortname,
acard->wss->port,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 027/103] ALSA: cs423x: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (25 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 026/103] ALSA: cmi8330: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-18 9:28 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 028/103] ALSA: es1688: " Takashi Iwai
` (76 subsequent siblings)
103 siblings, 1 reply; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/cs423x/cs4236.c | 2 +-
sound/isa/cs423x/cs4236_lib.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index ad20bb2649bd..e36cc147651a 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -510,7 +510,7 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev,
return -ENODEV;
/* prepare second id */
- strcpy(cid, pdev->id[0].id);
+ strscpy(cid, pdev->id[0].id);
cid[5] = '1';
cdev = NULL;
list_for_each_entry(iter, &(pdev->protocol->devices), protocol_list) {
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c
index 1a03cff6915b..eaaf39aae526 100644
--- a/sound/isa/cs423x/cs4236_lib.c
+++ b/sound/isa/cs423x/cs4236_lib.c
@@ -1023,7 +1023,7 @@ int snd_cs4236_mixer(struct snd_wss *chip)
if (snd_BUG_ON(!chip || !chip->card))
return -EINVAL;
card = chip->card;
- strcpy(card->mixername, snd_wss_chip_id(chip));
+ strscpy(card->mixername, snd_wss_chip_id(chip));
if (chip->hardware == WSS_HW_CS4235 ||
chip->hardware == WSS_HW_CS4239) {
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 028/103] ALSA: es1688: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (26 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 027/103] ALSA: cs423x: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 029/103] ALSA: es18xx: " Takashi Iwai
` (75 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/es1688/es1688_lib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c
index c0c230149a75..2ef183f197ad 100644
--- a/sound/isa/es1688/es1688_lib.c
+++ b/sound/isa/es1688/es1688_lib.c
@@ -706,7 +706,7 @@ int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device)
pcm->private_data = chip;
pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
- strcpy(pcm->name, snd_es1688_chip_id(chip));
+ strscpy(pcm->name, snd_es1688_chip_id(chip));
chip->pcm = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev,
@@ -971,7 +971,7 @@ int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip)
if (snd_BUG_ON(!chip || !card))
return -EINVAL;
- strcpy(card->mixername, snd_es1688_chip_id(chip));
+ strscpy(card->mixername, snd_es1688_chip_id(chip));
for (idx = 0; idx < ARRAY_SIZE(snd_es1688_controls); idx++) {
err = snd_ctl_add(card, snd_ctl_new1(&snd_es1688_controls[idx], chip));
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 029/103] ALSA: es18xx: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (27 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 028/103] ALSA: es1688: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 030/103] ALSA: galaxy: " Takashi Iwai
` (74 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/es18xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index e35c727a52fa..3e89a84c6244 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1771,7 +1771,7 @@ static int snd_es18xx_mixer(struct snd_card *card)
int err;
unsigned int idx;
- strcpy(card->mixername, chip->pcm->name);
+ strscpy(card->mixername, chip->pcm->name);
for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_base_controls); idx++) {
struct snd_kcontrol *kctl;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 030/103] ALSA: galaxy: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (28 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 029/103] ALSA: es18xx: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 031/103] ALSA: gus: " Takashi Iwai
` (73 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/galaxy/galaxy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c
index 3164eb8510fa..b0f1562d0fc0 100644
--- a/sound/isa/galaxy/galaxy.c
+++ b/sound/isa/galaxy/galaxy.c
@@ -542,8 +542,8 @@ static int __snd_galaxy_probe(struct device *dev, unsigned int n)
return err;
}
- strcpy(card->driver, DRV_NAME);
- strcpy(card->shortname, DRV_NAME);
+ strscpy(card->driver, DRV_NAME);
+ strscpy(card->shortname, DRV_NAME);
sprintf(card->longname, "%s at %#lx/%#lx, irq %d, dma %d/%d",
card->shortname, port[n], wss_port[n], irq[n], dma1[n],
dma2[n]);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 031/103] ALSA: gus: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (29 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 030/103] ALSA: galaxy: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 032/103] ALSA: msnd: " Takashi Iwai
` (72 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/gus/gus_main.c | 16 ++++++++--------
sound/isa/gus/gus_mixer.c | 2 +-
sound/isa/gus/gus_pcm.c | 2 +-
sound/isa/gus/gus_timer.c | 4 ++--
sound/isa/gus/gus_uart.c | 2 +-
sound/isa/gus/gusextreme.c | 8 ++++----
sound/isa/gus/gusmax.c | 16 ++++++++--------
sound/isa/gus/interwave.c | 34 +++++++++++++++++-----------------
8 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index 7166869e423d..873ef4046cd6 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -348,8 +348,8 @@ static int snd_gus_check_version(struct snd_gus_card * gus)
rev = inb(GUSP(gus, BOARDVERSION));
spin_unlock_irqrestore(&gus->reg_lock, flags);
dev_dbg(card->dev, "GF1 [0x%lx] init - val = 0x%x, rev = 0x%x\n", gus->gf1.port, val, rev);
- strcpy(card->driver, "GUS");
- strcpy(card->longname, "Gravis UltraSound Classic (2.4)");
+ strscpy(card->driver, "GUS");
+ strscpy(card->longname, "Gravis UltraSound Classic (2.4)");
if ((val != 255 && (val & 0x06)) || (rev >= 5 && rev != 255)) {
if (rev >= 5 && rev <= 9) {
gus->ics_flag = 1;
@@ -360,16 +360,16 @@ static int snd_gus_check_version(struct snd_gus_card * gus)
}
if (rev >= 10 && rev != 255) {
if (rev >= 10 && rev <= 11) {
- strcpy(card->driver, "GUS MAX");
- strcpy(card->longname, "Gravis UltraSound MAX");
+ strscpy(card->driver, "GUS MAX");
+ strscpy(card->longname, "Gravis UltraSound MAX");
gus->max_flag = 1;
} else if (rev == 0x30) {
- strcpy(card->driver, "GUS ACE");
- strcpy(card->longname, "Gravis UltraSound Ace");
+ strscpy(card->driver, "GUS ACE");
+ strscpy(card->longname, "Gravis UltraSound Ace");
gus->ace_flag = 1;
} else if (rev == 0x50) {
- strcpy(card->driver, "GUS Extreme");
- strcpy(card->longname, "Gravis UltraSound Extreme");
+ strscpy(card->driver, "GUS Extreme");
+ strscpy(card->longname, "Gravis UltraSound Extreme");
gus->ess_flag = 1;
} else {
dev_err(card->dev,
diff --git a/sound/isa/gus/gus_mixer.c b/sound/isa/gus/gus_mixer.c
index 03f9cfcbf601..60c3a8219770 100644
--- a/sound/isa/gus/gus_mixer.c
+++ b/sound/isa/gus/gus_mixer.c
@@ -152,7 +152,7 @@ int snd_gf1_new_mixer(struct snd_gus_card * gus)
if (gus->ics_flag)
snd_component_add(card, "ICS2101");
if (card->mixername[0] == '\0') {
- strcpy(card->mixername, gus->ics_flag ? "GF1,ICS2101" : "GF1");
+ strscpy(card->mixername, gus->ics_flag ? "GF1,ICS2101" : "GF1");
} else {
if (gus->ics_flag)
strcat(card->mixername, ",ICS2101");
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index 16f9bbb43a54..8b9b7b8d92b2 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -851,7 +851,7 @@ int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index)
SNDRV_DMA_TYPE_DEV, card->dev,
64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024);
}
- strcpy(pcm->name, pcm->id);
+ strscpy(pcm->name, pcm->id);
if (gus->interwave) {
sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A');
}
diff --git a/sound/isa/gus/gus_timer.c b/sound/isa/gus/gus_timer.c
index 047ddbc6192f..7267fb5bf8e5 100644
--- a/sound/isa/gus/gus_timer.c
+++ b/sound/isa/gus/gus_timer.c
@@ -156,7 +156,7 @@ void snd_gf1_timers_init(struct snd_gus_card * gus)
tid.subdevice = 0;
if (snd_timer_new(gus->card, "GF1 timer", &tid, &timer) >= 0) {
- strcpy(timer->name, "GF1 timer #1");
+ strscpy(timer->name, "GF1 timer #1");
timer->private_data = gus;
timer->private_free = snd_gf1_timer1_free;
timer->hw = snd_gf1_timer1;
@@ -166,7 +166,7 @@ void snd_gf1_timers_init(struct snd_gus_card * gus)
tid.device++;
if (snd_timer_new(gus->card, "GF1 timer", &tid, &timer) >= 0) {
- strcpy(timer->name, "GF1 timer #2");
+ strscpy(timer->name, "GF1 timer #2");
timer->private_data = gus;
timer->private_free = snd_gf1_timer2_free;
timer->hw = snd_gf1_timer2;
diff --git a/sound/isa/gus/gus_uart.c b/sound/isa/gus/gus_uart.c
index 08276509447f..e207f274f240 100644
--- a/sound/isa/gus/gus_uart.c
+++ b/sound/isa/gus/gus_uart.c
@@ -236,7 +236,7 @@ int snd_gf1_rawmidi_new(struct snd_gus_card *gus, int device)
err = snd_rawmidi_new(gus->card, "GF1", device, 1, 1, &rmidi);
if (err < 0)
return err;
- strcpy(rmidi->name, gus->interwave ? "AMD InterWave" : "GF1");
+ strscpy(rmidi->name, gus->interwave ? "AMD InterWave" : "GF1");
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_gf1_uart_output);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_gf1_uart_input);
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX;
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index 6eab95bd49c1..28827a2e6cbd 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -204,15 +204,15 @@ static int snd_gusextreme_mixer(struct snd_card *card)
id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
/* reassign AUX to SYNTHESIZER */
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "Synth Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "Synth Playback Volume");
error = snd_ctl_rename_id(card, &id1, &id2);
if (error < 0)
return error;
/* reassign Master Playback Switch to Synth Playback Switch */
- strcpy(id1.name, "Master Playback Switch");
- strcpy(id2.name, "Synth Playback Switch");
+ strscpy(id1.name, "Master Playback Switch");
+ strscpy(id2.name, "Synth Playback Switch");
error = snd_ctl_rename_id(card, &id1, &id2);
if (error < 0)
return error;
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index 445fd2fb50f1..b572411c4422 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -134,24 +134,24 @@ static int snd_gusmax_mixer(struct snd_wss *chip)
memset(&id2, 0, sizeof(id2));
id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
/* reassign AUXA to SYNTHESIZER */
- strcpy(id1.name, "Aux Playback Switch");
- strcpy(id2.name, "Synth Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch");
+ strscpy(id2.name, "Synth Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "Synth Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "Synth Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
/* reassign AUXB to CD */
- strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
- strcpy(id2.name, "CD Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch"); id1.index = 1;
+ strscpy(id2.name, "CD Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "CD Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "CD Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 18a98123e286..0e0bcd85a648 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -271,7 +271,7 @@ static int snd_interwave_detect(struct snd_interwave *iwcard,
dev_dbg(gus->card->dev,
"[0x%lx] InterWave check - passed\n", gus->gf1.port);
gus->interwave = 1;
- strcpy(gus->card->shortname, "AMD InterWave");
+ strscpy(gus->card->shortname, "AMD InterWave");
gus->revision = rev1 >> 4;
#ifndef SNDRV_STB
return 0; /* ok.. We have an InterWave board */
@@ -500,11 +500,11 @@ static int snd_interwave_mixer(struct snd_wss *chip)
id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
#if 0
/* remove mono microphone controls */
- strcpy(id1.name, "Mic Playback Switch");
+ strscpy(id1.name, "Mic Playback Switch");
err = snd_ctl_remove_id(card, &id1);
if (err < 0)
return err;
- strcpy(id1.name, "Mic Playback Volume");
+ strscpy(id1.name, "Mic Playback Volume");
err = snd_ctl_remove_id(card, &id1);
if (err < 0)
return err;
@@ -520,24 +520,24 @@ static int snd_interwave_mixer(struct snd_wss *chip)
snd_wss_out(chip, CS4231_LEFT_MIC_INPUT, 0x9f);
snd_wss_out(chip, CS4231_RIGHT_MIC_INPUT, 0x9f);
/* reassign AUXA to SYNTHESIZER */
- strcpy(id1.name, "Aux Playback Switch");
- strcpy(id2.name, "Synth Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch");
+ strscpy(id2.name, "Synth Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "Synth Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "Synth Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
/* reassign AUXB to CD */
- strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
- strcpy(id2.name, "CD Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch"); id1.index = 1;
+ strscpy(id2.name, "CD Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "CD Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "CD Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
@@ -713,14 +713,14 @@ static int snd_interwave_probe(struct snd_card *card, int dev,
memset(&id1, 0, sizeof(id1));
memset(&id2, 0, sizeof(id2));
id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
- strcpy(id1.name, "Master Playback Switch");
- strcpy(id2.name, id1.name);
+ strscpy(id1.name, "Master Playback Switch");
+ strscpy(id2.name, id1.name);
id2.index = 1;
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
- strcpy(id1.name, "Master Playback Volume");
- strcpy(id2.name, id1.name);
+ strscpy(id1.name, "Master Playback Volume");
+ strscpy(id2.name, id1.name);
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
@@ -742,8 +742,8 @@ static int snd_interwave_probe(struct snd_card *card, int dev,
#else
str = "InterWave STB";
#endif
- strcpy(card->driver, str);
- strcpy(card->shortname, str);
+ strscpy(card->driver, str);
+ strscpy(card->shortname, str);
sprintf(card->longname, "%s at 0x%lx, irq %i, dma %d",
str,
gus->gf1.port,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 032/103] ALSA: msnd: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (30 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 031/103] ALSA: gus: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 033/103] ALSA: opl3sa2: " Takashi Iwai
` (71 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/msnd/msnd.c | 2 +-
sound/isa/msnd/msnd_pinnacle.c | 22 +++++++++++-----------
sound/isa/msnd/msnd_pinnacle_mixer.c | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/sound/isa/msnd/msnd.c b/sound/isa/msnd/msnd.c
index 69c515421dd8..8c1d2e27854b 100644
--- a/sound/isa/msnd/msnd.c
+++ b/sound/isa/msnd/msnd.c
@@ -673,7 +673,7 @@ int snd_msnd_pcm(struct snd_card *card, int device)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_msnd_capture_ops);
pcm->private_data = chip;
- strcpy(pcm->name, "Hurricane");
+ strscpy(pcm->name, "Hurricane");
return 0;
}
diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c
index 8caf431677e5..969bbb18657b 100644
--- a/sound/isa/msnd/msnd_pinnacle.c
+++ b/sound/isa/msnd/msnd_pinnacle.c
@@ -221,8 +221,8 @@ static int snd_msnd_probe(struct snd_card *card)
}
#ifdef MSND_CLASSIC
- strcpy(card->shortname, "Classic/Tahiti/Monterey");
- strcpy(card->longname, "Turtle Beach Multisound");
+ strscpy(card->shortname, "Classic/Tahiti/Monterey");
+ strscpy(card->longname, "Turtle Beach Multisound");
dev_info(card->dev, LOGNAME ": %s, "
"I/O 0x%lx-0x%lx, IRQ %d, memory mapped to 0x%lX-0x%lX\n",
card->shortname,
@@ -251,38 +251,38 @@ static int snd_msnd_probe(struct snd_card *card)
switch (info & 0x7) {
case 0x0:
rev = "I";
- strcpy(card->shortname, pin);
+ strscpy(card->shortname, pin);
break;
case 0x1:
rev = "F";
- strcpy(card->shortname, pin);
+ strscpy(card->shortname, pin);
break;
case 0x2:
rev = "G";
- strcpy(card->shortname, pin);
+ strscpy(card->shortname, pin);
break;
case 0x3:
rev = "H";
- strcpy(card->shortname, pin);
+ strscpy(card->shortname, pin);
break;
case 0x4:
rev = "E";
- strcpy(card->shortname, fiji);
+ strscpy(card->shortname, fiji);
break;
case 0x5:
rev = "C";
- strcpy(card->shortname, fiji);
+ strscpy(card->shortname, fiji);
break;
case 0x6:
rev = "D";
- strcpy(card->shortname, fiji);
+ strscpy(card->shortname, fiji);
break;
case 0x7:
rev = "A-B (Fiji) or A-E (Pinnacle)";
- strcpy(card->shortname, pinfiji);
+ strscpy(card->shortname, pinfiji);
break;
}
- strcpy(card->longname, "Turtle Beach Multisound Pinnacle");
+ strscpy(card->longname, "Turtle Beach Multisound Pinnacle");
dev_info(card->dev, LOGNAME ": %s revision %s, Xilinx version %s, "
"I/O 0x%lx-0x%lx, IRQ %d, memory mapped to 0x%lX-0x%lX\n",
card->shortname,
diff --git a/sound/isa/msnd/msnd_pinnacle_mixer.c b/sound/isa/msnd/msnd_pinnacle_mixer.c
index 63633bd41e5b..2f1bb5a2b376 100644
--- a/sound/isa/msnd/msnd_pinnacle_mixer.c
+++ b/sound/isa/msnd/msnd_pinnacle_mixer.c
@@ -299,7 +299,7 @@ int snd_msndmix_new(struct snd_card *card)
if (snd_BUG_ON(!chip))
return -EINVAL;
spin_lock_init(&chip->mixer_lock);
- strcpy(card->mixername, "MSND Pinnacle Mixer");
+ strscpy(card->mixername, "MSND Pinnacle Mixer");
for (idx = 0; idx < ARRAY_SIZE(snd_msnd_controls); idx++) {
err = snd_ctl_add(card,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 033/103] ALSA: opl3sa2: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (31 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 032/103] ALSA: msnd: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 034/103] ALSA: opti9xx: " Takashi Iwai
` (70 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/opl3sa2.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index a5ed5aa0606f..5e8e1326d5c0 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -488,30 +488,30 @@ static int snd_opl3sa2_mixer(struct snd_card *card)
memset(&id2, 0, sizeof(id2));
id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
/* reassign AUX0 to CD */
- strcpy(id1.name, "Aux Playback Switch");
- strcpy(id2.name, "CD Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch");
+ strscpy(id2.name, "CD Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "Cannot rename opl3sa2 control\n");
return err;
}
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "CD Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "CD Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "Cannot rename opl3sa2 control\n");
return err;
}
/* reassign AUX1 to FM */
- strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
- strcpy(id2.name, "FM Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch"); id1.index = 1;
+ strscpy(id2.name, "FM Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "Cannot rename opl3sa2 control\n");
return err;
}
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "FM Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "FM Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "Cannot rename opl3sa2 control\n");
@@ -618,8 +618,8 @@ static int snd_opl3sa2_card_new(struct device *pdev, int dev,
sizeof(struct snd_opl3sa2), &card);
if (err < 0)
return err;
- strcpy(card->driver, "OPL3SA2");
- strcpy(card->shortname, "Yamaha OPL3-SA");
+ strscpy(card->driver, "OPL3SA2");
+ strscpy(card->shortname, "Yamaha OPL3-SA");
chip = card->private_data;
spin_lock_init(&chip->reg_lock);
chip->irq = -1;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 034/103] ALSA: opti9xx: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (32 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 033/103] ALSA: opl3sa2: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 035/103] ALSA: sc6000: " Takashi Iwai
` (69 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/opti9xx/miro.c | 8 ++++----
sound/isa/opti9xx/opti92x-ad1848.c | 18 +++++++++---------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index 31d736d1dd10..ad7180d7c0c2 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -718,10 +718,10 @@ static int snd_miro_mixer(struct snd_card *card,
switch (miro->hardware) {
case OPTi9XX_HW_82C924:
- strcpy(card->mixername, "ACI & OPTi924");
+ strscpy(card->mixername, "ACI & OPTi924");
break;
case OPTi9XX_HW_82C929:
- strcpy(card->mixername, "ACI & OPTi929");
+ strscpy(card->mixername, "ACI & OPTi929");
break;
default:
snd_BUG();
@@ -779,7 +779,7 @@ static int snd_miro_init(struct snd_miro *chip,
static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
chip->hardware = hardware;
- strcpy(chip->name, snd_opti9xx_names[hardware]);
+ strscpy(chip->name, snd_opti9xx_names[hardware]);
chip->mc_base_size = opti9xx_mc_size[hardware];
@@ -1351,7 +1351,7 @@ static int snd_miro_probe(struct snd_card *card)
sprintf(card->shortname, "unknown Cardinal Technologies");
}
- strcpy(card->driver, "miro");
+ strscpy(card->driver, "miro");
scnprintf(card->longname, sizeof(card->longname),
"%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
card->shortname, miro->name, codec->pcm->name,
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index a07a665d93dc..328d043a1619 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -171,7 +171,7 @@ static int snd_opti9xx_init(struct snd_opti9xx *chip,
static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
chip->hardware = hardware;
- strcpy(chip->name, snd_opti9xx_names[hardware]);
+ strscpy(chip->name, snd_opti9xx_names[hardware]);
spin_lock_init(&chip->lock);
@@ -594,35 +594,35 @@ static int snd_opti93x_mixer(struct snd_wss *chip)
card = chip->card;
- strcpy(card->mixername, chip->pcm->name);
+ strscpy(card->mixername, chip->pcm->name);
memset(&id1, 0, sizeof(id1));
memset(&id2, 0, sizeof(id2));
id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
/* reassign AUX0 switch to CD */
- strcpy(id1.name, "Aux Playback Switch");
- strcpy(id2.name, "CD Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch");
+ strscpy(id2.name, "CD Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "Cannot rename opti93x control\n");
return err;
}
/* reassign AUX1 switch to FM */
- strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
- strcpy(id2.name, "FM Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch"); id1.index = 1;
+ strscpy(id2.name, "FM Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
dev_err(card->dev, "Cannot rename opti93x control\n");
return err;
}
/* remove AUX1 volume */
- strcpy(id1.name, "Aux Playback Volume"); id1.index = 1;
+ strscpy(id1.name, "Aux Playback Volume"); id1.index = 1;
snd_ctl_remove_id(card, &id1);
/* Replace WSS volume controls with OPTi93x volume controls */
id1.index = 0;
for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) {
- strcpy(id1.name, snd_opti93x_controls[idx].name);
+ strscpy(id1.name, snd_opti93x_controls[idx].name);
snd_ctl_remove_id(card, &id1);
err = snd_ctl_add(card,
@@ -857,7 +857,7 @@ static int snd_opti9xx_probe(struct snd_card *card)
#endif
chip->irq = irq;
card->sync_irq = chip->irq;
- strcpy(card->driver, chip->name);
+ strscpy(card->driver, chip->name);
sprintf(card->shortname, "OPTi %s", card->driver);
#if defined(CS4231) || defined(OPTi93X)
scnprintf(card->longname, sizeof(card->longname),
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 035/103] ALSA: sc6000: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (33 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 034/103] ALSA: opti9xx: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 036/103] ALSA: sscape: " Takashi Iwai
` (68 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/sc6000.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index 3115c32b4061..6d618cc2ba45 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -469,24 +469,24 @@ static int snd_sc6000_mixer(struct snd_wss *chip)
id1.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
/* reassign AUX0 to FM */
- strcpy(id1.name, "Aux Playback Switch");
- strcpy(id2.name, "FM Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch");
+ strscpy(id2.name, "FM Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "FM Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "FM Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
/* reassign AUX1 to CD */
- strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
- strcpy(id2.name, "CD Playback Switch");
+ strscpy(id1.name, "Aux Playback Switch"); id1.index = 1;
+ strscpy(id2.name, "CD Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
- strcpy(id1.name, "Aux Playback Volume");
- strcpy(id2.name, "CD Playback Volume");
+ strscpy(id1.name, "Aux Playback Volume");
+ strscpy(id2.name, "CD Playback Volume");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0)
return err;
@@ -652,8 +652,8 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)
mpu_port[dev]);
}
- strcpy(card->driver, DRV_NAME);
- strcpy(card->shortname, "SC-6000");
+ strscpy(card->driver, DRV_NAME);
+ strscpy(card->shortname, "SC-6000");
sprintf(card->longname, "Gallant SC-6000 at 0x%lx, irq %d, dma %d",
mss_port[dev], xirq, xdma);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 036/103] ALSA: sscape: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (34 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 035/103] ALSA: sc6000: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 037/103] ALSA: wavefront: " Takashi Iwai
` (67 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/sscape.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 09120e38f4c2..709a1659d66f 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -1047,8 +1047,8 @@ static int create_sscape(int dev, struct snd_card *card)
wss_port[dev], irq[dev]);
return err;
}
- strcpy(card->driver, "SoundScape");
- strcpy(card->shortname, name);
+ strscpy(card->driver, "SoundScape");
+ strscpy(card->shortname, name);
snprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, IRQ %d, DMA1 %d, DMA2 %d\n",
name, sscape->chip->port, sscape->chip->irq,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 037/103] ALSA: wavefront: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (35 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 036/103] ALSA: sscape: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 038/103] ALSA: wss: " Takashi Iwai
` (66 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/wavefront/wavefront.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 621ab420a60f..07c68568091d 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -234,7 +234,7 @@ static struct snd_hwdep *snd_wavefront_new_synth(struct snd_card *card,
if (snd_hwdep_new(card, "WaveFront", hw_dev, &wavefront_synth) < 0)
return NULL;
- strcpy (wavefront_synth->name,
+ strscpy (wavefront_synth->name,
"WaveFront (ICS2115) wavetable synthesizer");
wavefront_synth->ops.open = snd_wavefront_synth_open;
wavefront_synth->ops.release = snd_wavefront_synth_release;
@@ -292,10 +292,10 @@ static struct snd_rawmidi *snd_wavefront_new_midi(struct snd_card *card,
return NULL;
if (mpu == internal_mpu) {
- strcpy(rmidi->name, "WaveFront MIDI (Internal)");
+ strscpy(rmidi->name, "WaveFront MIDI (Internal)");
rmidi->private_data = &internal_id;
} else {
- strcpy(rmidi->name, "WaveFront MIDI (External)");
+ strscpy(rmidi->name, "WaveFront MIDI (External)");
rmidi->private_data = &external_id;
}
@@ -407,7 +407,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
return -ENOMEM;
}
- strcpy (wavefront_synth->name, "ICS2115 Wavetable MIDI Synthesizer");
+ strscpy (wavefront_synth->name, "ICS2115 Wavetable MIDI Synthesizer");
wavefront_synth->iface = SNDRV_HWDEP_IFACE_ICS2115;
hw_dev++;
@@ -478,12 +478,12 @@ snd_wavefront_probe (struct snd_card *card, int dev)
hw_dev++;
- strcpy(card->driver, "Tropez+");
- strcpy(card->shortname, "Turtle Beach Tropez+");
+ strscpy(card->driver, "Tropez+");
+ strscpy(card->shortname, "Turtle Beach Tropez+");
} else {
/* Need a way to distinguish between Maui and Tropez */
- strcpy(card->driver, "WaveFront");
- strcpy(card->shortname, "Turtle Beach WaveFront");
+ strscpy(card->driver, "WaveFront");
+ strscpy(card->shortname, "Turtle Beach WaveFront");
}
/* ----- Register the card --------- */
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 038/103] ALSA: wss: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (36 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 037/103] ALSA: wavefront: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 039/103] ALSA: mips: " Takashi Iwai
` (65 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/isa/wss/wss_lib.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c
index 9c655789574d..1b6a80021d18 100644
--- a/sound/isa/wss/wss_lib.c
+++ b/sound/isa/wss/wss_lib.c
@@ -1865,7 +1865,7 @@ int snd_wss_pcm(struct snd_wss *chip, int device)
pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX;
if (chip->hardware != WSS_HW_INTERWAVE)
pcm->info_flags |= SNDRV_PCM_INFO_JOINT_DUPLEX;
- strcpy(pcm->name, snd_wss_chip_id(chip));
+ strscpy(pcm->name, snd_wss_chip_id(chip));
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, chip->card->dev,
64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
@@ -1896,7 +1896,7 @@ int snd_wss_timer(struct snd_wss *chip, int device)
err = snd_timer_new(chip->card, "CS4231", &tid, &timer);
if (err < 0)
return err;
- strcpy(timer->name, snd_wss_chip_id(chip));
+ strscpy(timer->name, snd_wss_chip_id(chip));
timer->private_data = chip;
timer->private_free = snd_wss_timer_free;
timer->hw = snd_wss_timer_table;
@@ -2176,7 +2176,7 @@ int snd_wss_mixer(struct snd_wss *chip)
card = chip->card;
- strcpy(card->mixername, chip->pcm->name);
+ strscpy(card->mixername, chip->pcm->name);
/* Use only the first 11 entries on AD1848 */
if (chip->hardware & WSS_HW_AD1848_MASK)
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 039/103] ALSA: mips: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (37 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 038/103] ALSA: wss: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 040/103] ALSA: parisc: " Takashi Iwai
` (64 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/mips/hal2.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c
index 991793e6bda9..f88e6a6733a5 100644
--- a/sound/mips/hal2.c
+++ b/sound/mips/hal2.c
@@ -706,7 +706,7 @@ static int hal2_pcm_create(struct snd_hal2 *hal2)
return err;
pcm->private_data = hal2;
- strcpy(pcm->name, "SGI HAL2");
+ strscpy(pcm->name, "SGI HAL2");
/* set operators */
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
@@ -862,8 +862,8 @@ static int hal2_probe(struct platform_device *pdev)
return err;
}
- strcpy(card->driver, "SGI HAL2 Audio");
- strcpy(card->shortname, "SGI HAL2 Audio");
+ strscpy(card->driver, "SGI HAL2 Audio");
+ strscpy(card->shortname, "SGI HAL2 Audio");
sprintf(card->longname, "%s irq %i",
card->shortname,
SGI_HPCDMA_IRQ);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 040/103] ALSA: parisc: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (38 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 039/103] ALSA: mips: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 041/103] ALSA: ac97: " Takashi Iwai
` (63 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/parisc/harmony.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index db9c296dd688..76dd2210f9ea 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -601,7 +601,7 @@ snd_harmony_pcm_init(struct snd_harmony *h)
pcm->private_data = h;
pcm->info_flags = 0;
- strcpy(pcm->name, "harmony");
+ strscpy(pcm->name, "harmony");
h->pcm = pcm;
h->psubs = NULL;
@@ -823,7 +823,7 @@ snd_harmony_mixer_init(struct snd_harmony *h)
if (snd_BUG_ON(!h))
return -EINVAL;
card = h->card;
- strcpy(card->mixername, "Harmony Gain control interface");
+ strscpy(card->mixername, "Harmony Gain control interface");
for (idx = 0; idx < HARMONY_CONTROLS; idx++) {
err = snd_ctl_add(card,
@@ -937,8 +937,8 @@ snd_harmony_probe(struct parisc_device *padev)
if (err < 0)
goto free_and_ret;
- strcpy(card->driver, "harmony");
- strcpy(card->shortname, "Harmony");
+ strscpy(card->driver, "harmony");
+ strscpy(card->shortname, "Harmony");
sprintf(card->longname, "%s at 0x%lx, irq %i",
card->shortname, h->hpa, h->irq);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 041/103] ALSA: ac97: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (39 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 040/103] ALSA: parisc: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 042/103] ALSA: ad1889: " Takashi Iwai
` (62 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ac97/ac97_codec.c | 4 ++--
sound/pci/ac97/ac97_patch.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 88ac37739b76..588c094080be 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -2303,7 +2303,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
if (ac97_is_audio(ac97)) {
char comp[16];
if (card->mixername[0] == '\0') {
- strcpy(card->mixername, name);
+ strscpy(card->mixername, name);
} else {
if (strlen(card->mixername) + 1 + strlen(name) + 1 <= sizeof(card->mixername)) {
strcat(card->mixername, ",");
@@ -2324,7 +2324,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
if (ac97_is_modem(ac97)) {
char comp[16];
if (card->mixername[0] == '\0') {
- strcpy(card->mixername, name);
+ strscpy(card->mixername, name);
} else {
if (strlen(card->mixername) + 1 + strlen(name) + 1 <= sizeof(card->mixername)) {
strcat(card->mixername, ",");
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index cd83aa864ea3..3002be9d88f3 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -298,7 +298,7 @@ static int patch_yamaha_ymf7x3_3d(struct snd_ac97 *ac97)
err = snd_ctl_add(ac97->bus->card, kctl);
if (err < 0)
return err;
- strcpy(kctl->id.name, "3D Control - Wide");
+ strscpy(kctl->id.name, "3D Control - Wide");
kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 9, 7, 0);
snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000);
err = snd_ctl_add(ac97->bus->card,
@@ -891,7 +891,7 @@ static int patch_sigmatel_stac9700_3d(struct snd_ac97 * ac97)
err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97));
if (err < 0)
return err;
- strcpy(kctl->id.name, "3D Control Sigmatel - Depth");
+ strscpy(kctl->id.name, "3D Control Sigmatel - Depth");
kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 2, 3, 0);
snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000);
return 0;
@@ -906,13 +906,13 @@ static int patch_sigmatel_stac9708_3d(struct snd_ac97 * ac97)
err = snd_ctl_add(ac97->bus->card, kctl);
if (err < 0)
return err;
- strcpy(kctl->id.name, "3D Control Sigmatel - Depth");
+ strscpy(kctl->id.name, "3D Control Sigmatel - Depth");
kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 0, 3, 0);
kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97);
err = snd_ctl_add(ac97->bus->card, kctl);
if (err < 0)
return err;
- strcpy(kctl->id.name, "3D Control Sigmatel - Rear Depth");
+ strscpy(kctl->id.name, "3D Control Sigmatel - Rear Depth");
kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 2, 3, 0);
snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000);
return 0;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 042/103] ALSA: ad1889: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (40 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 041/103] ALSA: ac97: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 043/103] ALSA: ak4531: " Takashi Iwai
` (61 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ad1889.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index ac27a93ce4ff..020cbb467e7e 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -605,7 +605,7 @@ snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device)
pcm->private_data = chip;
pcm->info_flags = 0;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcm = pcm;
chip->psubs = NULL;
@@ -866,8 +866,8 @@ __snd_ad1889_probe(struct pci_dev *pci,
return err;
chip = card->private_data;
- strcpy(card->driver, "AD1889");
- strcpy(card->shortname, "Analog Devices AD1889");
+ strscpy(card->driver, "AD1889");
+ strscpy(card->shortname, "Analog Devices AD1889");
/* (3) */
err = snd_ad1889_create(card, pci);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 043/103] ALSA: ak4531: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (41 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 042/103] ALSA: ad1889: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 044/103] ALSA: ali5451: " Takashi Iwai
` (60 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ak4531_codec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/ak4531_codec.c b/sound/pci/ak4531_codec.c
index 6af88e7b86f8..e54812bfb2c6 100644
--- a/sound/pci/ak4531_codec.c
+++ b/sound/pci/ak4531_codec.c
@@ -389,7 +389,7 @@ int snd_ak4531_mixer(struct snd_card *card,
snd_ak4531_free(ak4531);
return err;
}
- strcpy(card->mixername, "Asahi Kasei AK4531");
+ strscpy(card->mixername, "Asahi Kasei AK4531");
ak4531->write(ak4531, AK4531_RESET, 0x03); /* no RST, PD */
udelay(100);
ak4531->write(ak4531, AK4531_CLOCK, 0x00); /* CODEC ADC and CODEC DAC use {LR,B}CLK2 and run off LRCLK2 PLL */
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 044/103] ALSA: ali5451: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (42 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 043/103] ALSA: ak4531: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 045/103] ALSA: als300: " Takashi Iwai
` (59 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ali5451/ali5451.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 69c02bdd38ce..a6e499e0ceda 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -1645,7 +1645,7 @@ static int snd_ali_pcm(struct snd_ali *codec, int device,
pcm->info_flags = 0;
pcm->dev_class = desc->class;
pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
- strcpy(pcm->name, desc->name);
+ strscpy(pcm->name, desc->name);
codec->pcm[0] = pcm;
return 0;
}
@@ -2133,8 +2133,8 @@ static int __snd_ali_probe(struct pci_dev *pci,
snd_ali_proc_init(codec);
- strcpy(card->driver, "ALI5451");
- strcpy(card->shortname, "ALI 5451");
+ strscpy(card->driver, "ALI5451");
+ strscpy(card->shortname, "ALI 5451");
sprintf(card->longname, "%s at 0x%lx, irq %i",
card->shortname, codec->port, codec->irq);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 045/103] ALSA: als300: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (43 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 044/103] ALSA: ali5451: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 046/103] ALSA: als4000: " Takashi Iwai
` (58 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/als300.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 43f98719e61b..f9e8424dc77f 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -546,7 +546,7 @@ static int snd_als300_new_pcm(struct snd_als300 *chip)
if (err < 0)
return err;
pcm->private_data = chip;
- strcpy(pcm->name, "ALS300");
+ strscpy(pcm->name, "ALS300");
chip->pcm = pcm;
/* set operators */
@@ -705,7 +705,7 @@ static int snd_als300_probe(struct pci_dev *pci,
if (err < 0)
goto error;
- strcpy(card->driver, "ALS300");
+ strscpy(card->driver, "ALS300");
if (chip->chip_type == DEVICE_ALS300_PLUS)
/* don't know much about ALS300+ yet
* print revision number for now */
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 046/103] ALSA: als4000: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (44 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 045/103] ALSA: als300: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 047/103] ALSA: asihpi: " Takashi Iwai
` (57 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/als4000.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 3f4f3037f71f..eb159497c905 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -877,8 +877,8 @@ static int __snd_card_als4000_probe(struct pci_dev *pci,
snd_als4000_configure(chip);
- strcpy(card->driver, "ALS4000");
- strcpy(card->shortname, "Avance Logic ALS4000");
+ strscpy(card->driver, "ALS4000");
+ strscpy(card->shortname, "Avance Logic ALS4000");
sprintf(card->longname, "%s at 0x%lx, irq %i",
card->shortname, chip->alt_port, chip->irq);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 047/103] ALSA: asihpi: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (45 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 046/103] ALSA: als4000: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 048/103] ALSA: atiixp: " Takashi Iwai
` (56 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/asihpi/asihpi.c | 10 +++++-----
sound/pci/asihpi/hpi6000.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index cbd964f87349..8419f2b6e589 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -1257,7 +1257,7 @@ static int snd_card_asihpi_pcm_new(struct snd_card_asihpi *asihpi, int device)
pcm->private_data = asihpi;
pcm->info_flags = 0;
- strcpy(pcm->name, "Asihpi PCM");
+ strscpy(pcm->name, "Asihpi PCM");
/*? do we want to emulate MMAP for non-BBM cards?
Jack doesn't work with ALSAs MMAP emulation - WHY NOT? */
@@ -2310,7 +2310,7 @@ static int snd_asihpi_clksrc_info(struct snd_kcontrol *kcontrol,
uinfo->value.enumerated.item =
uinfo->value.enumerated.items - 1;
- strcpy(uinfo->value.enumerated.name,
+ strscpy(uinfo->value.enumerated.name,
clkcache->s[uinfo->value.enumerated.item].name);
return 0;
}
@@ -2530,7 +2530,7 @@ static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
if (snd_BUG_ON(!asihpi))
return -EINVAL;
card = asihpi->card;
- strcpy(card->mixername, "Asihpi Mixer");
+ strscpy(card->mixername, "Asihpi Mixer");
err =
hpi_mixer_open(asihpi->hpi->adapter->index,
@@ -2741,7 +2741,7 @@ static int snd_asihpi_hpi_new(struct snd_card_asihpi *asihpi, int device)
err = snd_hwdep_new(asihpi->card, "HPI", device, &hw);
if (err < 0)
return err;
- strcpy(hw->name, "asihpi (HPI)");
+ strscpy(hw->name, "asihpi (HPI)");
hw->iface = SNDRV_HWDEP_IFACE_LAST;
hw->ops.open = snd_asihpi_hpi_open;
hw->ops.ioctl = snd_asihpi_hpi_ioctl;
@@ -2889,7 +2889,7 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev,
by enable_hwdep module param*/
snd_asihpi_hpi_new(asihpi, 0);
- strcpy(card->driver, "ASIHPI");
+ strscpy(card->driver, "ASIHPI");
sprintf(card->shortname, "AudioScience ASI%4X",
asihpi->hpi->adapter->type);
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c
index 72aa135d69f8..b08578c93c6a 100644
--- a/sound/pci/asihpi/hpi6000.c
+++ b/sound/pci/asihpi/hpi6000.c
@@ -608,7 +608,7 @@ static void adapter_get_asserts(struct hpi_adapter_obj *pao,
phr->u.ax.assert.p2 = 0;
phr->u.ax.assert.count = 1; /* assert count */
phr->u.ax.assert.dsp_index = -1; /* "dsp index" */
- strcpy(phr->u.ax.assert.sz_message, "PCI2040 error");
+ strscpy(phr->u.ax.assert.sz_message, "PCI2040 error");
phr->u.ax.assert.dsp_msg_addr = 0;
gw_pci_read_asserts = 0;
gw_pci_write_asserts = 0;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 048/103] ALSA: atiixp: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (46 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 047/103] ALSA: asihpi: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 049/103] ALSA: au88x0: " Takashi Iwai
` (55 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/atiixp.c | 10 +++++-----
sound/pci/atiixp_modem.c | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 427006be240b..4f544950ee7b 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1271,7 +1271,7 @@ static int snd_atiixp_pcm_new(struct atiixp *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_atiixp_capture_ops);
pcm->private_data = chip;
- strcpy(pcm->name, "ATI IXP AC97");
+ strscpy(pcm->name, "ATI IXP AC97");
chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1301,9 +1301,9 @@ static int snd_atiixp_pcm_new(struct atiixp *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_spdif_ops);
pcm->private_data = chip;
if (chip->spdif_over_aclink)
- strcpy(pcm->name, "ATI IXP IEC958 (AC97)");
+ strscpy(pcm->name, "ATI IXP IEC958 (AC97)");
else
- strcpy(pcm->name, "ATI IXP IEC958 (Direct)");
+ strscpy(pcm->name, "ATI IXP IEC958 (Direct)");
chip->pcmdevs[ATI_PCMDEV_DIGITAL] = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1576,8 +1576,8 @@ static int __snd_atiixp_probe(struct pci_dev *pci,
return err;
chip = card->private_data;
- strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA");
- strcpy(card->shortname, "ATI IXP");
+ strscpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA");
+ strscpy(card->shortname, "ATI IXP");
err = snd_atiixp_init(card, pci);
if (err < 0)
return err;
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 8d3083b9b024..f7417c2bb477 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -982,7 +982,7 @@ static int snd_atiixp_pcm_new(struct atiixp_modem *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_atiixp_capture_ops);
pcm->dev_class = SNDRV_PCM_CLASS_MODEM;
pcm->private_data = chip;
- strcpy(pcm->name, "ATI IXP MC97");
+ strscpy(pcm->name, "ATI IXP MC97");
chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1206,8 +1206,8 @@ static int __snd_atiixp_probe(struct pci_dev *pci,
return err;
chip = card->private_data;
- strcpy(card->driver, "ATIIXP-MODEM");
- strcpy(card->shortname, "ATI IXP Modem");
+ strscpy(card->driver, "ATIIXP-MODEM");
+ strscpy(card->shortname, "ATI IXP Modem");
err = snd_atiixp_init(card, pci);
if (err < 0)
return err;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 049/103] ALSA: au88x0: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (47 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 048/103] ALSA: atiixp: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 050/103] ALSA: aw2: " Takashi Iwai
` (54 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/au88x0/au88x0.c | 4 ++--
sound/pci/au88x0/au88x0_mixer.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index fd986247331a..de56e83d8e10 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -220,7 +220,7 @@ __snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
snd_vortex_workaround(pci, pcifix[dev]);
// Card details needed in snd_vortex_midi
- strcpy(card->driver, CARD_NAME_SHORT);
+ strscpy(card->driver, CARD_NAME_SHORT);
sprintf(card->shortname, "Aureal Vortex %s", CARD_NAME_SHORT);
sprintf(card->longname, "%s at 0x%lx irq %i",
card->shortname, chip->io, chip->irq);
@@ -270,7 +270,7 @@ __snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
snd_vortex_synth_arg_t *arg;
arg = SNDRV_SEQ_DEVICE_ARGPTR(wave);
- strcpy(wave->name, "Aureal Synth");
+ strscpy(wave->name, "Aureal Synth");
arg->hwptr = vortex;
arg->index = 1;
arg->seq_ports = seq_ports[dev];
diff --git a/sound/pci/au88x0/au88x0_mixer.c b/sound/pci/au88x0/au88x0_mixer.c
index aeba684b8d18..00781a7fd28c 100644
--- a/sound/pci/au88x0/au88x0_mixer.c
+++ b/sound/pci/au88x0/au88x0_mixer.c
@@ -15,7 +15,7 @@ static int remove_ctl(struct snd_card *card, const char *name)
{
struct snd_ctl_elem_id id;
memset(&id, 0, sizeof(id));
- strcpy(id.name, name);
+ strscpy(id.name, name);
id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
return snd_ctl_remove_id(card, &id);
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 050/103] ALSA: aw2: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (48 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 049/103] ALSA: au88x0: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 051/103] ALSA: azt3328: " Takashi Iwai
` (53 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/aw2/aw2-alsa.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 7b4b8f785517..1d7aab14579e 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -281,8 +281,8 @@ static int snd_aw2_probe(struct pci_dev *pci,
/* init spinlock */
spin_lock_init(&chip->reg_lock);
/* (4) Define driver ID and name string */
- strcpy(card->driver, "aw2");
- strcpy(card->shortname, "Audiowerk2");
+ strscpy(card->driver, "aw2");
+ strscpy(card->shortname, "Audiowerk2");
sprintf(card->longname, "%s with SAA7146 irq %i",
card->shortname, chip->irq);
@@ -509,7 +509,7 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
pcm_device = &chip->device_playback[NUM_STREAM_PLAYBACK_ANA];
/* Set PCM device name */
- strcpy(pcm_playback_ana->name, "Analog playback");
+ strscpy(pcm_playback_ana->name, "Analog playback");
/* Associate private data to PCM device */
pcm_playback_ana->private_data = pcm_device;
/* set operators of PCM device */
@@ -541,7 +541,7 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
pcm_device = &chip->device_playback[NUM_STREAM_PLAYBACK_DIG];
/* Set PCM device name */
- strcpy(pcm_playback_num->name, "Digital playback");
+ strscpy(pcm_playback_num->name, "Digital playback");
/* Associate private data to PCM device */
pcm_playback_num->private_data = pcm_device;
/* set operators of PCM device */
@@ -574,7 +574,7 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
pcm_device = &chip->device_capture[NUM_STREAM_CAPTURE_ANA];
/* Set PCM device name */
- strcpy(pcm_capture->name, "Capture");
+ strscpy(pcm_capture->name, "Capture");
/* Associate private data to PCM device */
pcm_capture->private_data = pcm_device;
/* set operators of PCM device */
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 051/103] ALSA: azt3328: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (49 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 050/103] ALSA: aw2: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 052/103] ALSA: bt87x: " Takashi Iwai
` (52 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/azt3328.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 053a18f434bf..4418b9ae33e6 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1188,7 +1188,7 @@ snd_azf3328_mixer_new(struct snd_azf3328 *chip)
return err;
}
snd_component_add(card, "AZF3328 mixer");
- strcpy(card->mixername, "AZF3328 mixer");
+ strscpy(card->mixername, "AZF3328 mixer");
return 0;
}
@@ -2095,7 +2095,7 @@ snd_azf3328_pcm(struct snd_azf3328 *chip)
pcm->private_data = chip;
pcm->info_flags = 0;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
/* same pcm object for playback/capture (see snd_pcm_new() above) */
chip->pcm[AZF_CODEC_PLAYBACK] = pcm;
chip->pcm[AZF_CODEC_CAPTURE] = pcm;
@@ -2112,7 +2112,7 @@ snd_azf3328_pcm(struct snd_azf3328 *chip)
pcm->private_data = chip;
pcm->info_flags = 0;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcm[AZF_CODEC_I2S_OUT] = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
@@ -2217,7 +2217,7 @@ snd_azf3328_timer(struct snd_azf3328 *chip, int device)
if (err < 0)
goto out;
- strcpy(timer->name, "AZF3328 timer");
+ strscpy(timer->name, "AZF3328 timer");
timer->private_data = chip;
timer->hw = snd_azf3328_timer_hw;
@@ -2437,8 +2437,8 @@ __snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
return err;
chip = card->private_data;
- strcpy(card->driver, "AZF3328");
- strcpy(card->shortname, "Aztech AZF3328 (PCI168)");
+ strscpy(card->driver, "AZF3328");
+ strscpy(card->shortname, "Aztech AZF3328 (PCI168)");
err = snd_azf3328_create(card, pci, pci_id->driver_data);
if (err < 0)
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 052/103] ALSA: bt87x: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (50 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 051/103] ALSA: azt3328: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 053/103] ALSA: ca0106: " Takashi Iwai
` (51 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/bt87x.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 91492dd2b38a..b70f6f4ffe67 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -672,7 +672,7 @@ static int snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *name)
if (err < 0)
return err;
pcm->private_data = chip;
- strcpy(pcm->name, name);
+ strscpy(pcm->name, name);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_bt87x_pcm_ops);
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
&chip->pci->dev,
@@ -872,12 +872,12 @@ static int __snd_bt87x_probe(struct pci_dev *pci,
chip->board.no_analog ? "no " : "",
chip->board.no_digital ? "no " : "", chip->board.dig_rate);
- strcpy(card->driver, "Bt87x");
+ strscpy(card->driver, "Bt87x");
sprintf(card->shortname, "Brooktree Bt%x", pci->device);
sprintf(card->longname, "%s at %#llx, irq %i",
card->shortname, (unsigned long long)pci_resource_start(pci, 0),
chip->irq);
- strcpy(card->mixername, "Bt87x");
+ strscpy(card->mixername, "Bt87x");
err = snd_card_register(card);
if (err < 0)
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 053/103] ALSA: ca0106: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (51 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 052/103] ALSA: bt87x: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 054/103] ALSA: cmipci: " Takashi Iwai
` (50 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ca0106/ca0106_main.c | 6 +++---
sound/pci/ca0106/ca0106_mixer.c | 4 ++--
sound/pci/ca0106/ca_midi.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 7c7119cad63c..242618793181 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1315,7 +1315,7 @@ static int snd_ca0106_pcm(struct snd_ca0106 *emu, int device)
}
pcm->info_flags = 0;
- strcpy(pcm->name, "CA0106");
+ strscpy(pcm->name, "CA0106");
for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
substream;
@@ -1617,8 +1617,8 @@ static int snd_ca0106_create(int dev, struct snd_card *card,
pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
dev_info(card->dev, "Model %04x Rev %08x Serial %08x\n",
chip->model, pci->revision, chip->serial);
- strcpy(card->driver, "CA0106");
- strcpy(card->shortname, "CA0106");
+ strscpy(card->driver, "CA0106");
+ strscpy(card->shortname, "CA0106");
for (c = ca0106_chip_details; c->serial; c++) {
if (subsystem[dev]) {
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index 1d5a899b2c24..f7b6b2db889b 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -701,7 +701,7 @@ static int remove_ctl(struct snd_card *card, const char *name)
{
struct snd_ctl_elem_id id;
memset(&id, 0, sizeof(id));
- strcpy(id.name, name);
+ strscpy(id.name, name);
id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
return snd_ctl_remove_id(card, &id);
}
@@ -849,7 +849,7 @@ int snd_ca0106_mixer(struct snd_ca0106 *emu)
return err;
}
- strcpy(card->mixername, "CA0106");
+ strscpy(card->mixername, "CA0106");
return 0;
}
diff --git a/sound/pci/ca0106/ca_midi.c b/sound/pci/ca0106/ca_midi.c
index 957e60f64821..f9cec67f31ac 100644
--- a/sound/pci/ca0106/ca_midi.c
+++ b/sound/pci/ca0106/ca_midi.c
@@ -287,7 +287,7 @@ int ca_midi_init(void *dev_id, struct snd_ca_midi *midi, int device, char *name)
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, &ca_midi_output);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &ca_midi_input);
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT |
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 054/103] ALSA: cmipci: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (52 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 053/103] ALSA: ca0106: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 055/103] ALSA: cs4281: " Takashi Iwai
` (49 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/cmipci.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index b00df0a60d3f..9056214e9cda 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -1868,7 +1868,7 @@ static int snd_cmipci_pcm_new(struct cmipci *cm, int device)
pcm->private_data = cm;
pcm->info_flags = 0;
- strcpy(pcm->name, "C-Media PCI DAC/ADC");
+ strscpy(pcm->name, "C-Media PCI DAC/ADC");
cm->pcm = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1890,7 +1890,7 @@ static int snd_cmipci_pcm2_new(struct cmipci *cm, int device)
pcm->private_data = cm;
pcm->info_flags = 0;
- strcpy(pcm->name, "C-Media PCI 2nd DAC");
+ strscpy(pcm->name, "C-Media PCI 2nd DAC");
cm->pcm2 = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1913,7 +1913,7 @@ static int snd_cmipci_pcm_spdif_new(struct cmipci *cm, int device)
pcm->private_data = cm;
pcm->info_flags = 0;
- strcpy(pcm->name, "C-Media PCI IEC958");
+ strscpy(pcm->name, "C-Media PCI IEC958");
cm->pcm_spdif = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -2633,7 +2633,7 @@ static int snd_cmipci_mixer_new(struct cmipci *cm, int pcm_spdif_device)
card = cm->card;
- strcpy(card->mixername, "CMedia PCI");
+ strscpy(card->mixername, "CMedia PCI");
spin_lock_irq(&cm->reg_lock);
snd_cmipci_mixer_write(cm, 0x00, 0x00); /* mixer reset */
@@ -3216,14 +3216,14 @@ static int snd_cmipci_probe(struct pci_dev *pci,
switch (pci->device) {
case PCI_DEVICE_ID_CMEDIA_CM8738:
case PCI_DEVICE_ID_CMEDIA_CM8738B:
- strcpy(card->driver, "CMI8738");
+ strscpy(card->driver, "CMI8738");
break;
case PCI_DEVICE_ID_CMEDIA_CM8338A:
case PCI_DEVICE_ID_CMEDIA_CM8338B:
- strcpy(card->driver, "CMI8338");
+ strscpy(card->driver, "CMI8338");
break;
default:
- strcpy(card->driver, "CMIPCI");
+ strscpy(card->driver, "CMIPCI");
break;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 055/103] ALSA: cs4281: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (53 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 054/103] ALSA: cmipci: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-18 9:40 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 056/103] ALSA: cs46xx: " Takashi Iwai
` (48 subsequent siblings)
103 siblings, 1 reply; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/cs4281.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 90958a422b75..31cb9cbe2f03 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -950,7 +950,7 @@ static int snd_cs4281_pcm(struct cs4281 *chip, int device)
pcm->private_data = chip;
pcm->info_flags = 0;
- strcpy(pcm->name, "CS4281");
+ strscpy(pcm->name, "CS4281");
chip->pcm = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
@@ -1715,7 +1715,7 @@ static int snd_cs4281_midi(struct cs4281 *chip, int device)
err = snd_rawmidi_new(chip->card, "CS4281", device, 1, 1, &rmidi);
if (err < 0)
return err;
- strcpy(rmidi->name, "CS4281");
+ strscpy(rmidi->name, "CS4281");
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_cs4281_midi_output);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_cs4281_midi_input);
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX;
@@ -1870,8 +1870,8 @@ static int __snd_cs4281_probe(struct pci_dev *pci,
if (err < 0)
return err;
snd_cs4281_create_gameport(chip);
- strcpy(card->driver, "CS4281");
- strcpy(card->shortname, "Cirrus Logic CS4281");
+ strscpy(card->driver, "CS4281");
+ strscpy(card->shortname, "Cirrus Logic CS4281");
sprintf(card->longname, "%s at 0x%lx, irq %d",
card->shortname,
chip->ba0_addr,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 056/103] ALSA: cs46xx: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (54 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 055/103] ALSA: cs4281: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-18 9:41 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 057/103] ALSA: cs5530: " Takashi Iwai
` (47 subsequent siblings)
103 siblings, 1 reply; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/cs46xx/cs46xx.c | 4 ++--
sound/pci/cs46xx/cs46xx_lib.c | 20 ++++++++++----------
sound/pci/cs46xx/dsp_spos.c | 8 ++++----
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index 8634004a606b..9c1995737eb7 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -107,8 +107,8 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci,
snd_cs46xx_gameport(chip);
- strcpy(card->driver, "CS46xx");
- strcpy(card->shortname, "Sound Fusion CS46xx");
+ strscpy(card->driver, "CS46xx");
+ strscpy(card->shortname, "Sound Fusion CS46xx");
sprintf(card->longname, "%s at 0x%lx/0x%lx, irq %i",
card->shortname,
chip->ba0_addr,
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index fb733633740b..85a7988cf822 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -1760,7 +1760,7 @@ int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device)
/* global setup */
pcm->info_flags = 0;
- strcpy(pcm->name, "CS46xx");
+ strscpy(pcm->name, "CS46xx");
chip->pcm = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1787,7 +1787,7 @@ int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device)
/* global setup */
pcm->info_flags = 0;
- strcpy(pcm->name, "CS46xx - Rear");
+ strscpy(pcm->name, "CS46xx - Rear");
chip->pcm_rear = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1812,7 +1812,7 @@ int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device)
/* global setup */
pcm->info_flags = 0;
- strcpy(pcm->name, "CS46xx - Center LFE");
+ strscpy(pcm->name, "CS46xx - Center LFE");
chip->pcm_center_lfe = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1837,7 +1837,7 @@ int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device)
/* global setup */
pcm->info_flags = 0;
- strcpy(pcm->name, "CS46xx - IEC958");
+ strscpy(pcm->name, "CS46xx - IEC958");
chip->pcm_iec958 = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -2672,7 +2672,7 @@ int snd_cs46xx_midi(struct snd_cs46xx *chip, int device)
err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi);
if (err < 0)
return err;
- strcpy(rmidi->name, "CS46XX");
+ strscpy(rmidi->name, "CS46XX");
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_cs46xx_midi_output);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_cs46xx_midi_input);
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX;
@@ -3853,27 +3853,27 @@ int snd_cs46xx_create(struct snd_card *card,
}
region = &chip->region.name.ba0;
- strcpy(region->name, "CS46xx_BA0");
+ strscpy(region->name, "CS46xx_BA0");
region->base = chip->ba0_addr;
region->size = CS46XX_BA0_SIZE;
region = &chip->region.name.data0;
- strcpy(region->name, "CS46xx_BA1_data0");
+ strscpy(region->name, "CS46xx_BA1_data0");
region->base = chip->ba1_addr + BA1_SP_DMEM0;
region->size = CS46XX_BA1_DATA0_SIZE;
region = &chip->region.name.data1;
- strcpy(region->name, "CS46xx_BA1_data1");
+ strscpy(region->name, "CS46xx_BA1_data1");
region->base = chip->ba1_addr + BA1_SP_DMEM1;
region->size = CS46XX_BA1_DATA1_SIZE;
region = &chip->region.name.pmem;
- strcpy(region->name, "CS46xx_BA1_pmem");
+ strscpy(region->name, "CS46xx_BA1_pmem");
region->base = chip->ba1_addr + BA1_SP_PMEM;
region->size = CS46XX_BA1_PRG_SIZE;
region = &chip->region.name.reg;
- strcpy(region->name, "CS46xx_BA1_reg");
+ strscpy(region->name, "CS46xx_BA1_reg");
region->base = chip->ba1_addr + BA1_SP_REG;
region->size = CS46XX_BA1_REG_SIZE;
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 1db6bc58d6a6..e07f85322f1c 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -203,7 +203,7 @@ add_symbol (struct snd_cs46xx * chip, char * symbol_name, u32 address, int type)
index = find_free_symbol_index (ins);
- strcpy (ins->symbol_table.symbols[index].symbol_name, symbol_name);
+ strscpy (ins->symbol_table.symbols[index].symbol_name, symbol_name);
ins->symbol_table.symbols[index].address = address;
ins->symbol_table.symbols[index].symbol_type = type;
ins->symbol_table.symbols[index].module = NULL;
@@ -923,7 +923,7 @@ static struct dsp_scb_descriptor * _map_scb (struct snd_cs46xx *chip, char * nam
index = find_free_scb_index (ins);
memset(&ins->scbs[index], 0, sizeof(ins->scbs[index]));
- strcpy(ins->scbs[index].scb_name, name);
+ strscpy(ins->scbs[index].scb_name, name);
ins->scbs[index].address = dest;
ins->scbs[index].index = index;
ins->scbs[index].ref_count = 1;
@@ -953,9 +953,9 @@ _map_task_tree (struct snd_cs46xx *chip, char * name, u32 dest, u32 size)
}
if (name)
- strcpy(ins->tasks[ins->ntask].task_name, name);
+ strscpy(ins->tasks[ins->ntask].task_name, name);
else
- strcpy(ins->tasks[ins->ntask].task_name, "(NULL)");
+ strscpy(ins->tasks[ins->ntask].task_name, "(NULL)");
ins->tasks[ins->ntask].address = dest;
ins->tasks[ins->ntask].size = size;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 057/103] ALSA: cs5530: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (55 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 056/103] ALSA: cs46xx: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-18 9:41 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 058/103] ALSA: cs5535audio: " Takashi Iwai
` (46 subsequent siblings)
103 siblings, 1 reply; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/cs5530.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c
index 532891e67c34..292b65aa758a 100644
--- a/sound/pci/cs5530.c
+++ b/sound/pci/cs5530.c
@@ -207,8 +207,8 @@ static int snd_cs5530_probe(struct pci_dev *pci,
if (err < 0)
return err;
- strcpy(card->driver, "CS5530");
- strcpy(card->shortname, "CS5530 Audio");
+ strscpy(card->driver, "CS5530");
+ strscpy(card->shortname, "CS5530 Audio");
sprintf(card->longname, "%s at 0x%lx", card->shortname, chip->pci_base);
err = snd_card_register(card);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 058/103] ALSA: cs5535audio: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (56 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 057/103] ALSA: cs5530: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-18 9:41 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 059/103] ALSA: ctxfi: " Takashi Iwai
` (45 subsequent siblings)
103 siblings, 1 reply; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/cs5535audio/cs5535audio.c | 4 ++--
sound/pci/cs5535audio/cs5535audio_pcm.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 0f319013a2a2..76566e7baea0 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -315,9 +315,9 @@ static int __snd_cs5535audio_probe(struct pci_dev *pci,
if (err < 0)
return err;
- strcpy(card->driver, DRIVER_NAME);
+ strscpy(card->driver, DRIVER_NAME);
- strcpy(card->shortname, "CS5535 Audio");
+ strscpy(card->shortname, "CS5535 Audio");
sprintf(card->longname, "%s %s at 0x%lx, irq %i",
card->shortname, card->driver,
cs5535au->port, cs5535au->irq);
diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c
index 9c88e99e3750..f296b2c63026 100644
--- a/sound/pci/cs5535audio/cs5535audio_pcm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pcm.c
@@ -423,7 +423,7 @@ int snd_cs5535audio_pcm(struct cs5535audio *cs5535au)
pcm->private_data = cs5535au;
pcm->info_flags = 0;
- strcpy(pcm->name, "CS5535 Audio");
+ strscpy(pcm->name, "CS5535 Audio");
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&cs5535au->pci->dev,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 059/103] ALSA: ctxfi: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (57 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 058/103] ALSA: cs5535audio: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 060/103] ALSA: echoaudio: " Takashi Iwai
` (44 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ctxfi/ctmixer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c
index 6797fde3d788..496682613db5 100644
--- a/sound/pci/ctxfi/ctmixer.c
+++ b/sound/pci/ctxfi/ctmixer.c
@@ -1219,7 +1219,7 @@ int ct_alsa_mix_create(struct ct_atc *atc,
if (err)
return err;
- strcpy(atc->card->mixername, device_name);
+ strscpy(atc->card->mixername, device_name);
return 0;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 060/103] ALSA: echoaudio: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (58 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 059/103] ALSA: ctxfi: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 061/103] ALSA: emu10k1: " Takashi Iwai
` (43 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/echoaudio/midi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c
index c3f3c9129561..4ee230794b4e 100644
--- a/sound/pci/echoaudio/midi.c
+++ b/sound/pci/echoaudio/midi.c
@@ -311,7 +311,7 @@ static int snd_echo_midi_create(struct snd_card *card,
if (err < 0)
return err;
- strcpy(chip->rmidi->name, card->shortname);
+ strscpy(chip->rmidi->name, card->shortname);
chip->rmidi->private_data = chip;
snd_rawmidi_set_ops(chip->rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 061/103] ALSA: emu10k1: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (59 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 060/103] ALSA: echoaudio: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 062/103] ALSA: ens1370: " Takashi Iwai
` (42 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/emu10k1/emumpu401.c | 2 +-
sound/pci/emu10k1/emupcm.c | 10 +++++-----
sound/pci/emu10k1/p16v.c | 2 +-
sound/pci/emu10k1/timer.c | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/pci/emu10k1/emumpu401.c b/sound/pci/emu10k1/emumpu401.c
index 747c34b3d566..efff19bbc0e9 100644
--- a/sound/pci/emu10k1/emumpu401.c
+++ b/sound/pci/emu10k1/emumpu401.c
@@ -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 |
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 1bf6e3d652f8..5414148057ea 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -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) {
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index a9a75891f1da..e774174d10de 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -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;
diff --git a/sound/pci/emu10k1/timer.c b/sound/pci/emu10k1/timer.c
index bb2478319361..1231ae2bf931 100644
--- a/sound/pci/emu10k1/timer.c
+++ b/sound/pci/emu10k1/timer.c
@@ -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;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 062/103] ALSA: ens1370: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (60 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 061/103] ALSA: emu10k1: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 063/103] ALSA: es1938: " Takashi Iwai
` (41 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ens1370.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 1e6adf1ae304..82e10ecb9196 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -1244,7 +1244,7 @@ static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device)
pcm->private_data = ensoniq;
pcm->info_flags = 0;
- strcpy(pcm->name, CHIP_NAME " DAC2/ADC");
+ strscpy(pcm->name, CHIP_NAME " DAC2/ADC");
ensoniq->pcm1 = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1276,7 +1276,7 @@ static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device)
#endif
pcm->private_data = ensoniq;
pcm->info_flags = 0;
- strcpy(pcm->name, CHIP_NAME " DAC1");
+ strscpy(pcm->name, CHIP_NAME " DAC1");
ensoniq->pcm2 = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -2250,7 +2250,7 @@ static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device)
err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi);
if (err < 0)
return err;
- strcpy(rmidi->name, CHIP_NAME);
+ strscpy(rmidi->name, CHIP_NAME);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input);
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT |
@@ -2346,9 +2346,9 @@ static int __snd_audiopci_probe(struct pci_dev *pci,
snd_ensoniq_create_gameport(ensoniq, dev);
- strcpy(card->driver, DRIVER_NAME);
+ strscpy(card->driver, DRIVER_NAME);
- strcpy(card->shortname, "Ensoniq AudioPCI");
+ strscpy(card->shortname, "Ensoniq AudioPCI");
sprintf(card->longname, "%s %s at 0x%lx, irq %i",
card->shortname,
card->driver,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 063/103] ALSA: es1938: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (61 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 062/103] ALSA: ens1370: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 064/103] ALSA: es1968: " Takashi Iwai
` (40 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/es1938.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 27728bdfac57..0ce7076206f9 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -982,7 +982,7 @@ static int snd_es1938_new_pcm(struct es1938 *chip, int device)
pcm->private_data = chip;
pcm->info_flags = 0;
- strcpy(pcm->name, "ESS Solo-1");
+ strscpy(pcm->name, "ESS Solo-1");
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->pci->dev, 64*1024, 64*1024);
@@ -1658,7 +1658,7 @@ static int snd_es1938_mixer(struct es1938 *chip)
card = chip->card;
- strcpy(card->mixername, "ESS Solo-1");
+ strscpy(card->mixername, "ESS Solo-1");
for (idx = 0; idx < ARRAY_SIZE(snd_es1938_controls); idx++) {
struct snd_kcontrol *kctl;
@@ -1720,8 +1720,8 @@ static int __snd_es1938_probe(struct pci_dev *pci,
if (err < 0)
return err;
- strcpy(card->driver, "ES1938");
- strcpy(card->shortname, "ESS ES1938 (Solo-1)");
+ strscpy(card->driver, "ES1938");
+ strscpy(card->shortname, "ESS ES1938 (Solo-1)");
sprintf(card->longname, "%s rev %i, irq %i",
card->shortname,
chip->revision,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 064/103] ALSA: es1968: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (62 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 063/103] ALSA: es1938: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 065/103] ALSA: fm801: " Takashi Iwai
` (39 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/es1968.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 37bac890613e..624ba7d47566 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -1812,7 +1812,7 @@ snd_es1968_pcm(struct es1968 *chip, int device)
pcm->info_flags = 0;
- strcpy(pcm->name, "ESS Maestro");
+ strscpy(pcm->name, "ESS Maestro");
chip->pcm = pcm;
@@ -2761,16 +2761,16 @@ static int __snd_es1968_probe(struct pci_dev *pci,
switch (chip->type) {
case TYPE_MAESTRO2E:
- strcpy(card->driver, "ES1978");
- strcpy(card->shortname, "ESS ES1978 (Maestro 2E)");
+ strscpy(card->driver, "ES1978");
+ strscpy(card->shortname, "ESS ES1978 (Maestro 2E)");
break;
case TYPE_MAESTRO2:
- strcpy(card->driver, "ES1968");
- strcpy(card->shortname, "ESS ES1968 (Maestro 2)");
+ strscpy(card->driver, "ES1968");
+ strscpy(card->shortname, "ESS ES1968 (Maestro 2)");
break;
case TYPE_MAESTRO:
- strcpy(card->driver, "ESM1");
- strcpy(card->shortname, "ESS Maestro 1");
+ strscpy(card->driver, "ESM1");
+ strscpy(card->shortname, "ESS Maestro 1");
break;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 065/103] ALSA: fm801: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (63 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 064/103] ALSA: es1968: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 066/103] ALSA: ice1712: " Takashi Iwai
` (38 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/fm801.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index f283256eda0d..cf40bd06b734 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -726,7 +726,7 @@ static int snd_fm801_pcm(struct fm801 *chip, int device)
pcm->private_data = chip;
pcm->info_flags = 0;
- strcpy(pcm->name, "FM801");
+ strscpy(pcm->name, "FM801");
chip->pcm = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &pdev->dev,
@@ -1291,8 +1291,8 @@ static int __snd_card_fm801_probe(struct pci_dev *pci,
if (err < 0)
return err;
- strcpy(card->driver, "FM801");
- strcpy(card->shortname, "ForteMedia FM801-");
+ strscpy(card->driver, "FM801");
+ strscpy(card->shortname, "ForteMedia FM801-");
strcat(card->shortname, chip->multichannel ? "AU" : "AS");
sprintf(card->longname, "%s at 0x%lx, irq %i",
card->shortname, chip->port, chip->irq);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 066/103] ALSA: ice1712: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (64 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 065/103] ALSA: fm801: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 067/103] ALSA: ice1724: " Takashi Iwai
` (37 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ice1712/ice1712.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index a8ac14887676..1aefd46ebf6b 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -850,7 +850,7 @@ static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device)
pcm->private_data = ice;
pcm->info_flags = 0;
- strcpy(pcm->name, "ICE1712 consumer");
+ strscpy(pcm->name, "ICE1712 consumer");
ice->pcm = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -875,7 +875,7 @@ static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device)
pcm->private_data = ice;
pcm->info_flags = 0;
- strcpy(pcm->name, "ICE1712 consumer (DS)");
+ strscpy(pcm->name, "ICE1712 consumer (DS)");
ice->pcm_ds = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1216,7 +1216,7 @@ static int snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device)
pcm->private_data = ice;
pcm->info_flags = 0;
- strcpy(pcm->name, "ICE1712 multi");
+ strscpy(pcm->name, "ICE1712 multi");
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&ice->pci->dev, 256*1024, 256*1024);
@@ -2559,8 +2559,8 @@ static int snd_ice1712_probe(struct pci_dev *pci,
return err;
ice = card->private_data;
- strcpy(card->driver, "ICE1712");
- strcpy(card->shortname, "ICEnsemble ICE1712");
+ strscpy(card->driver, "ICE1712");
+ strscpy(card->shortname, "ICEnsemble ICE1712");
err = snd_ice1712_create(card, pci, model[dev], omni[dev],
cs8427_timeout[dev], dxr_enable[dev]);
@@ -2570,9 +2570,9 @@ static int snd_ice1712_probe(struct pci_dev *pci,
for (tbl = card_tables; *tbl; tbl++) {
for (c = *tbl; c->subvendor; c++) {
if (c->subvendor == ice->eeprom.subvendor) {
- strcpy(card->shortname, c->name);
+ strscpy(card->shortname, c->name);
if (c->driver) /* specific driver? */
- strcpy(card->driver, c->driver);
+ strscpy(card->driver, c->driver);
if (c->chip_init) {
err = c->chip_init(ice);
if (err < 0)
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 067/103] ALSA: ice1724: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (65 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 066/103] ALSA: ice1712: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 068/103] ALSA: intel8x0: " Takashi Iwai
` (36 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ice1712/ice1724.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index be22b159e65a..0445d2e8e548 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -1118,7 +1118,7 @@ static int snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device)
pcm->private_data = ice;
pcm->info_flags = 0;
- strcpy(pcm->name, "ICE1724");
+ strscpy(pcm->name, "ICE1724");
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&ice->pci->dev, 256*1024, 256*1024);
@@ -1313,7 +1313,7 @@ static int snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device)
pcm->private_data = ice;
pcm->info_flags = 0;
- strcpy(pcm->name, name);
+ strscpy(pcm->name, name);
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&ice->pci->dev, 256*1024, 256*1024);
@@ -1425,7 +1425,7 @@ static int snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device)
pcm->private_data = ice;
pcm->info_flags = 0;
- strcpy(pcm->name, "ICE1724 Surround PCM");
+ strscpy(pcm->name, "ICE1724 Surround PCM");
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&ice->pci->dev, 256*1024, 256*1024);
@@ -1820,7 +1820,7 @@ static int snd_vt1724_pro_internal_clock_info(struct snd_kcontrol *kcontrol,
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
if (uinfo->value.enumerated.item >= hw_rates_count)
/* ext_clock items */
- strcpy(uinfo->value.enumerated.name,
+ strscpy(uinfo->value.enumerated.name,
ice->ext_clock_names[
uinfo->value.enumerated.item - hw_rates_count]);
else
@@ -2545,8 +2545,8 @@ static int __snd_vt1724_probe(struct pci_dev *pci,
return err;
ice = card->private_data;
- strcpy(card->driver, "ICE1724");
- strcpy(card->shortname, "ICEnsemble ICE1724");
+ strscpy(card->driver, "ICE1724");
+ strscpy(card->shortname, "ICEnsemble ICE1724");
err = snd_vt1724_create(card, pci, model[dev]);
if (err < 0)
@@ -2557,9 +2557,9 @@ static int __snd_vt1724_probe(struct pci_dev *pci,
c = ice->card_info;
if (c) {
- strcpy(card->shortname, c->name);
+ strscpy(card->shortname, c->name);
if (c->driver) /* specific driver? */
- strcpy(card->driver, c->driver);
+ strscpy(card->driver, c->driver);
if (c->chip_init) {
err = c->chip_init(ice);
if (err < 0)
@@ -2637,7 +2637,7 @@ static int __snd_vt1724_probe(struct pci_dev *pci,
return err;
ice->rmidi[0] = rmidi;
rmidi->private_data = ice;
- strcpy(rmidi->name, "ICE1724 MIDI");
+ strscpy(rmidi->name, "ICE1724 MIDI");
rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT |
SNDRV_RAWMIDI_INFO_INPUT |
SNDRV_RAWMIDI_INFO_DUPLEX;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 068/103] ALSA: intel8x0: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (66 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 067/103] ALSA: ice1724: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 069/103] ALSA: korg1212: " Takashi Iwai
` (35 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/intel8x0.c | 14 +++++++-------
sound/pci/intel8x0m.c | 10 +++++-----
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index b521cec20333..9e6a5065ffbf 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -1436,7 +1436,7 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
if (rec->suffix)
sprintf(name, "Intel ICH - %s", rec->suffix);
else
- strcpy(name, "Intel ICH");
+ strscpy(name, "Intel ICH");
err = snd_pcm_new(chip->card, name, device,
rec->playback_ops ? 1 : 0,
rec->capture_ops ? 1 : 0, &pcm);
@@ -1453,7 +1453,7 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
if (rec->suffix)
sprintf(pcm->name, "%s - %s", chip->card->shortname, rec->suffix);
else
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcm[device] = pcm;
snd_pcm_set_managed_buffer_all(pcm, intel8x0_dma_type(chip),
@@ -3118,21 +3118,21 @@ static int __snd_intel8x0_probe(struct pci_dev *pci,
if (spdif_aclink < 0)
spdif_aclink = check_default_spdif_aclink(pci);
- strcpy(card->driver, "ICH");
+ strscpy(card->driver, "ICH");
if (!spdif_aclink) {
switch (pci_id->driver_data) {
case DEVICE_NFORCE:
- strcpy(card->driver, "NFORCE");
+ strscpy(card->driver, "NFORCE");
break;
case DEVICE_INTEL_ICH4:
- strcpy(card->driver, "ICH4");
+ strscpy(card->driver, "ICH4");
}
}
- strcpy(card->shortname, "Intel ICH");
+ strscpy(card->shortname, "Intel ICH");
for (name = shortnames; name->id; name++) {
if (pci->device == name->id) {
- strcpy(card->shortname, name->s);
+ strscpy(card->shortname, name->s);
break;
}
}
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 1ce775fe8a70..9e5988583abe 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -678,7 +678,7 @@ static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device,
if (rec->suffix)
sprintf(name, "Intel ICH - %s", rec->suffix);
else
- strcpy(name, "Intel ICH");
+ strscpy(name, "Intel ICH");
err = snd_pcm_new(chip->card, name, device,
rec->playback_ops ? 1 : 0,
rec->capture_ops ? 1 : 0, &pcm);
@@ -696,7 +696,7 @@ static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device,
if (rec->suffix)
sprintf(pcm->name, "%s - %s", chip->card->shortname, rec->suffix);
else
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcm[device] = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1184,11 +1184,11 @@ static int __snd_intel8x0m_probe(struct pci_dev *pci,
return err;
chip = card->private_data;
- strcpy(card->driver, "ICH-MODEM");
- strcpy(card->shortname, "Intel ICH");
+ strscpy(card->driver, "ICH-MODEM");
+ strscpy(card->shortname, "Intel ICH");
for (name = shortnames; name->id; name++) {
if (pci->device == name->id) {
- strcpy(card->shortname, name->s);
+ strscpy(card->shortname, name->s);
break;
}
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 069/103] ALSA: korg1212: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (67 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 068/103] ALSA: intel8x0: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 070/103] ALSA: lola: " Takashi Iwai
` (34 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/korg1212/korg1212.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 56dea5b10828..0a66d5cfc090 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2249,7 +2249,7 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci)
korg1212->pcm->private_data = korg1212;
korg1212->pcm->private_free = snd_korg1212_free_pcm;
- strcpy(korg1212->pcm->name, "korg1212");
+ strscpy(korg1212->pcm->name, "korg1212");
snd_pcm_set_ops(korg1212->pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_korg1212_playback_ops);
@@ -2298,8 +2298,8 @@ snd_korg1212_probe(struct pci_dev *pci,
if (err < 0)
goto error;
- strcpy(card->driver, "korg1212");
- strcpy(card->shortname, "korg1212");
+ strscpy(card->driver, "korg1212");
+ strscpy(card->shortname, "korg1212");
sprintf(card->longname, "%s at 0x%lx, irq %d", card->shortname,
korg1212->iomem, korg1212->irq);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 070/103] ALSA: lola: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (68 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 069/103] ALSA: korg1212: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 071/103] ALSA: lx6464es: " Takashi Iwai
` (33 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/lola/lola.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
index fb8bd54e4c2d..8d927ecba165 100644
--- a/sound/pci/lola/lola.c
+++ b/sound/pci/lola/lola.c
@@ -630,12 +630,12 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci, int dev)
if (err < 0)
return err;
- strcpy(card->driver, "Lola");
+ strscpy(card->driver, "Lola");
strscpy(card->shortname, "Digigram Lola", sizeof(card->shortname));
snprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx irq %i",
card->shortname, chip->bar[0].addr, chip->irq);
- strcpy(card->mixername, card->shortname);
+ strscpy(card->mixername, card->shortname);
lola_irq_enable(chip);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 071/103] ALSA: lx6464es: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (69 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 070/103] ALSA: lola: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 072/103] ALSA: maestro3: " Takashi Iwai
` (32 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/lx6464es/lx6464es.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index 63ebf9803ea8..9f12c936bb1f 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -814,7 +814,7 @@ static int lx_pcm_create(struct lx6464es *chip)
pcm->info_flags = 0;
pcm->nonatomic = true;
- strcpy(pcm->name, card_name);
+ strscpy(pcm->name, card_name);
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->pci->dev, size, size);
@@ -1022,7 +1022,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
goto error;
}
- strcpy(card->driver, "LX6464ES");
+ strscpy(card->driver, "LX6464ES");
sprintf(card->id, "LX6464ES_%02X%02X%02X",
chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 072/103] ALSA: maestro3: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (70 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 071/103] ALSA: lx6464es: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 073/103] ALSA: mixart: " Takashi Iwai
` (31 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/maestro3.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index e61e15774706..e092097599ff 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -1846,7 +1846,7 @@ snd_m3_pcm(struct snd_m3 * chip, int device)
pcm->private_data = chip;
pcm->info_flags = 0;
- strcpy(pcm->name, chip->card->driver);
+ strscpy(pcm->name, chip->card->driver);
chip->pcm = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -2648,14 +2648,14 @@ __snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
switch (pci->device) {
case PCI_DEVICE_ID_ESS_ALLEGRO:
case PCI_DEVICE_ID_ESS_ALLEGRO_1:
- strcpy(card->driver, "Allegro");
+ strscpy(card->driver, "Allegro");
break;
case PCI_DEVICE_ID_ESS_CANYON3D_2LE:
case PCI_DEVICE_ID_ESS_CANYON3D_2:
- strcpy(card->driver, "Canyon3D-2");
+ strscpy(card->driver, "Canyon3D-2");
break;
default:
- strcpy(card->driver, "Maestro3");
+ strscpy(card->driver, "Maestro3");
break;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 073/103] ALSA: mixart: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (71 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 072/103] ALSA: maestro3: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 074/103] ALSA: nm256: " Takashi Iwai
` (30 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/mixart/mixart.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 7ceaf6a7a77e..cdc0ba5dd1ad 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -970,7 +970,7 @@ static int snd_mixart_pcm_analog(struct snd_mixart *chip)
pcm->info_flags = 0;
pcm->nonatomic = true;
- strcpy(pcm->name, name);
+ strscpy(pcm->name, name);
preallocate_buffers(chip, pcm);
@@ -1004,7 +1004,7 @@ static int snd_mixart_pcm_digital(struct snd_mixart *chip)
pcm->info_flags = 0;
pcm->nonatomic = true;
- strcpy(pcm->name, name);
+ strscpy(pcm->name, name);
preallocate_buffers(chip, pcm);
@@ -1330,7 +1330,7 @@ static int snd_mixart_probe(struct pci_dev *pci,
return err;
}
- strcpy(card->driver, CARD_NAME);
+ strscpy(card->driver, CARD_NAME);
snprintf(card->shortname, sizeof(card->shortname),
"Digigram miXart [PCM #%d]", i);
snprintf(card->longname, sizeof(card->longname),
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 074/103] ALSA: nm256: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (72 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 073/103] ALSA: mixart: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 075/103] ALSA: oxygen: " Takashi Iwai
` (29 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/nm256/nm256.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index cd4dc43dbff1..39464d171f6b 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1595,13 +1595,13 @@ static int snd_nm256_probe(struct pci_dev *pci,
switch (pci->device) {
case PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO:
- strcpy(card->driver, "NM256AV");
+ strscpy(card->driver, "NM256AV");
break;
case PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO:
- strcpy(card->driver, "NM256ZX");
+ strscpy(card->driver, "NM256ZX");
break;
case PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO:
- strcpy(card->driver, "NM256XL+");
+ strscpy(card->driver, "NM256XL+");
break;
default:
dev_err(&pci->dev, "invalid device id 0x%x\n", pci->device);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 075/103] ALSA: oxygen: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (73 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 074/103] ALSA: nm256: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 076/103] ALSA: pcxhr: " Takashi Iwai
` (28 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/oxygen/oxygen_lib.c | 6 +++---
sound/pci/oxygen/oxygen_pcm.c | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 39b8ccf37cdd..9c7270e4c35e 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -655,11 +655,11 @@ static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
chip->irq = pci->irq;
card->sync_irq = chip->irq;
- strcpy(card->driver, chip->model.chip);
- strcpy(card->shortname, chip->model.shortname);
+ strscpy(card->driver, chip->model.chip);
+ strscpy(card->shortname, chip->model.shortname);
sprintf(card->longname, "%s at %#lx, irq %i",
chip->model.longname, chip->addr, chip->irq);
- strcpy(card->mixername, chip->model.chip);
+ strscpy(card->mixername, chip->model.chip);
snd_component_add(card, chip->model.chip);
err = oxygen_pcm_init(chip);
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c
index b2a3fcfe31d4..643141f345bb 100644
--- a/sound/pci/oxygen/oxygen_pcm.c
+++ b/sound/pci/oxygen/oxygen_pcm.c
@@ -697,7 +697,7 @@ int oxygen_pcm_init(struct oxygen *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
&oxygen_rec_b_ops);
pcm->private_data = chip;
- strcpy(pcm->name, "Multichannel");
+ strscpy(pcm->name, "Multichannel");
if (outs)
snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
SNDRV_DMA_TYPE_DEV,
@@ -725,7 +725,7 @@ int oxygen_pcm_init(struct oxygen *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
&oxygen_rec_c_ops);
pcm->private_data = chip;
- strcpy(pcm->name, "Digital");
+ strscpy(pcm->name, "Digital");
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->pci->dev,
DEFAULT_BUFFER_BYTES,
@@ -755,7 +755,7 @@ int oxygen_pcm_init(struct oxygen *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
&oxygen_rec_b_ops);
pcm->private_data = chip;
- strcpy(pcm->name, outs ? "Front Panel" : "Analog 2");
+ strscpy(pcm->name, outs ? "Front Panel" : "Analog 2");
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->pci->dev,
DEFAULT_BUFFER_BYTES,
@@ -773,7 +773,7 @@ int oxygen_pcm_init(struct oxygen *chip)
OXYGEN_REC_C_ROUTE_I2S_ADC_3,
OXYGEN_REC_C_ROUTE_MASK);
pcm->private_data = chip;
- strcpy(pcm->name, "Analog 3");
+ strscpy(pcm->name, "Analog 3");
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->pci->dev,
DEFAULT_BUFFER_BYTES,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 076/103] ALSA: pcxhr: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (74 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 075/103] ALSA: oxygen: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:06 ` [PATCH 077/103] ALSA: riptide: " Takashi Iwai
` (27 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/pcxhr/pcxhr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 242bd7e04b3e..bfd84c50e981 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -1149,7 +1149,7 @@ int pcxhr_create_pcm(struct snd_pcxhr *chip)
pcm->info_flags = 0;
pcm->nonatomic = true;
- strcpy(pcm->name, name);
+ strscpy(pcm->name, name);
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->mgr->pci->dev,
@@ -1605,7 +1605,7 @@ static int pcxhr_probe(struct pci_dev *pci,
return err;
}
- strcpy(card->driver, DRIVER_NAME);
+ strscpy(card->driver, DRIVER_NAME);
snprintf(card->shortname, sizeof(card->shortname),
"Digigram [PCM #%d]", i);
snprintf(card->longname, sizeof(card->longname),
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 077/103] ALSA: riptide: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (75 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 076/103] ALSA: pcxhr: " Takashi Iwai
@ 2025-07-10 10:06 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 078/103] ALSA: rme32: " Takashi Iwai
` (26 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:06 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/riptide/riptide.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 578be0755b8a..e983cd657e28 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1688,7 +1688,7 @@ static int snd_riptide_pcm(struct snd_riptide *chip, int device)
&snd_riptide_capture_ops);
pcm->private_data = chip;
pcm->info_flags = 0;
- strcpy(pcm->name, "RIPTIDE");
+ strscpy(pcm->name, "RIPTIDE");
chip->pcm = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
&chip->pci->dev, 64 * 1024, 128 * 1024);
@@ -2098,8 +2098,8 @@ __snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
}
#endif
- strcpy(card->driver, "RIPTIDE");
- strcpy(card->shortname, "Riptide");
+ strscpy(card->driver, "RIPTIDE");
+ strscpy(card->shortname, "Riptide");
#ifdef SUPPORT_JOYSTICK
scnprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %i mpu 0x%x opl3 0x%x gameport 0x%x",
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 078/103] ALSA: rme32: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (76 preceding siblings ...)
2025-07-10 10:06 ` [PATCH 077/103] ALSA: riptide: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 079/103] ALSA: rme96: " Takashi Iwai
` (25 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/rme32.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 4bf122abea48..f07b6023473a 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1314,7 +1314,7 @@ static int snd_rme32_create(struct rme32 *rme32)
return err;
rme32->spdif_pcm->private_data = rme32;
rme32->spdif_pcm->private_free = snd_rme32_free_spdif_pcm;
- strcpy(rme32->spdif_pcm->name, "Digi32 IEC958");
+ strscpy(rme32->spdif_pcm->name, "Digi32 IEC958");
if (rme32->fullduplex_mode) {
snd_pcm_set_ops(rme32->spdif_pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_rme32_playback_spdif_fd_ops);
@@ -1344,7 +1344,7 @@ static int snd_rme32_create(struct rme32 *rme32)
return err;
rme32->adat_pcm->private_data = rme32;
rme32->adat_pcm->private_free = snd_rme32_free_adat_pcm;
- strcpy(rme32->adat_pcm->name, "Digi32 ADAT");
+ strscpy(rme32->adat_pcm->name, "Digi32 ADAT");
if (rme32->fullduplex_mode) {
snd_pcm_set_ops(rme32->adat_pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_rme32_playback_adat_fd_ops);
@@ -1879,16 +1879,16 @@ __snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
if (err < 0)
return err;
- strcpy(card->driver, "Digi32");
+ strscpy(card->driver, "Digi32");
switch (rme32->pci->device) {
case PCI_DEVICE_ID_RME_DIGI32:
- strcpy(card->shortname, "RME Digi32");
+ strscpy(card->shortname, "RME Digi32");
break;
case PCI_DEVICE_ID_RME_DIGI32_8:
- strcpy(card->shortname, "RME Digi32/8");
+ strscpy(card->shortname, "RME Digi32/8");
break;
case PCI_DEVICE_ID_RME_DIGI32_PRO:
- strcpy(card->shortname, "RME Digi32 PRO");
+ strscpy(card->shortname, "RME Digi32 PRO");
break;
}
sprintf(card->longname, "%s (Rev. %d) at 0x%lx, irq %d",
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 079/103] ALSA: rme96: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (77 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 078/103] ALSA: rme32: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 080/103] ALSA: hdsp: " Takashi Iwai
` (24 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/rme96.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 01029843d7f3..5cdbbe9cf994 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -1607,7 +1607,7 @@ snd_rme96_create(struct rme96 *rme96)
rme96->spdif_pcm->private_data = rme96;
rme96->spdif_pcm->private_free = snd_rme96_free_spdif_pcm;
- strcpy(rme96->spdif_pcm->name, "Digi96 IEC958");
+ strscpy(rme96->spdif_pcm->name, "Digi96 IEC958");
snd_pcm_set_ops(rme96->spdif_pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_rme96_playback_spdif_ops);
snd_pcm_set_ops(rme96->spdif_pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_rme96_capture_spdif_ops);
@@ -1624,7 +1624,7 @@ snd_rme96_create(struct rme96 *rme96)
return err;
rme96->adat_pcm->private_data = rme96;
rme96->adat_pcm->private_free = snd_rme96_free_adat_pcm;
- strcpy(rme96->adat_pcm->name, "Digi96 ADAT");
+ strscpy(rme96->adat_pcm->name, "Digi96 ADAT");
snd_pcm_set_ops(rme96->adat_pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_rme96_playback_adat_ops);
snd_pcm_set_ops(rme96->adat_pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_rme96_capture_adat_ops);
@@ -2434,23 +2434,23 @@ __snd_rme96_probe(struct pci_dev *pci,
return -ENOMEM;
}
- strcpy(card->driver, "Digi96");
+ strscpy(card->driver, "Digi96");
switch (rme96->pci->device) {
case PCI_DEVICE_ID_RME_DIGI96:
- strcpy(card->shortname, "RME Digi96");
+ strscpy(card->shortname, "RME Digi96");
break;
case PCI_DEVICE_ID_RME_DIGI96_8:
- strcpy(card->shortname, "RME Digi96/8");
+ strscpy(card->shortname, "RME Digi96/8");
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PRO:
- strcpy(card->shortname, "RME Digi96/8 PRO");
+ strscpy(card->shortname, "RME Digi96/8 PRO");
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST:
pci_read_config_byte(rme96->pci, 8, &val);
if (val < 5) {
- strcpy(card->shortname, "RME Digi96/8 PAD");
+ strscpy(card->shortname, "RME Digi96/8 PAD");
} else {
- strcpy(card->shortname, "RME Digi96/8 PST");
+ strscpy(card->shortname, "RME Digi96/8 PST");
}
break;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 080/103] ALSA: hdsp: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (78 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 079/103] ALSA: rme96: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 081/103] ALSA: hdspm: " Takashi Iwai
` (23 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/rme9652/hdsp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 8df0f5bba0f6..7ce73746168a 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -4944,7 +4944,7 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp)
hdsp->hwdep = hw;
hw->private_data = hdsp;
- strcpy(hw->name, "HDSP hwdep interface");
+ strscpy(hw->name, "HDSP hwdep interface");
hw->ops.ioctl = snd_hdsp_hwdep_ioctl;
hw->ops.ioctl_compat = snd_hdsp_hwdep_ioctl;
@@ -4963,7 +4963,7 @@ static int snd_hdsp_create_pcm(struct snd_card *card, struct hdsp *hdsp)
hdsp->pcm = pcm;
pcm->private_data = hdsp;
- strcpy(pcm->name, hdsp->card_name);
+ strscpy(pcm->name, hdsp->card_name);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_hdsp_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_hdsp_capture_ops);
@@ -5111,7 +5111,7 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp
}
if (!(hdsp->state & HDSP_InitializationComplete)) {
- strcpy(card->shortname, "Hammerfall DSP");
+ strscpy(card->shortname, "Hammerfall DSP");
sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
hdsp->port, hdsp->irq);
@@ -5255,8 +5255,8 @@ static int snd_hdsp_create(struct snd_card *card,
*/
pci_write_config_byte(hdsp->pci, PCI_LATENCY_TIMER, 0xFF);
- strcpy(card->driver, "H-DSP");
- strcpy(card->mixername, "Xilinx FPGA");
+ strscpy(card->driver, "H-DSP");
+ strscpy(card->mixername, "Xilinx FPGA");
if (hdsp->firmware_rev < 0xa)
return -ENODEV;
@@ -5412,7 +5412,7 @@ static int snd_hdsp_probe(struct pci_dev *pci,
if (err)
goto error;
- strcpy(card->shortname, "Hammerfall DSP");
+ strscpy(card->shortname, "Hammerfall DSP");
sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
hdsp->port, hdsp->irq);
err = snd_card_register(card);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 081/103] ALSA: hdspm: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (79 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 080/103] ALSA: hdsp: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 082/103] ALSA: rme9652: " Takashi Iwai
` (22 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/rme9652/hdspm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 2041cf00cca0..a0976824beda 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6355,7 +6355,7 @@ static int snd_hdspm_create_hwdep(struct snd_card *card,
hdspm->hwdep = hw;
hw->private_data = hdspm;
- strcpy(hw->name, "HDSPM hwdep interface");
+ strscpy(hw->name, "HDSPM hwdep interface");
hw->ops.open = snd_hdspm_hwdep_dummy_op;
hw->ops.ioctl = snd_hdspm_hwdep_ioctl;
@@ -6412,7 +6412,7 @@ static int snd_hdspm_create_pcm(struct snd_card *card,
hdspm->pcm = pcm;
pcm->private_data = hdspm;
- strcpy(pcm->name, hdspm->card_name);
+ strscpy(pcm->name, hdspm->card_name);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_hdspm_ops);
@@ -6512,8 +6512,8 @@ static int snd_hdspm_create(struct snd_card *card,
pci_read_config_word(hdspm->pci,
PCI_CLASS_REVISION, &hdspm->firmware_rev);
- strcpy(card->mixername, "Xilinx FPGA");
- strcpy(card->driver, "HDSPM");
+ strscpy(card->mixername, "Xilinx FPGA");
+ strscpy(card->driver, "HDSPM");
switch (hdspm->firmware_rev) {
case HDSPM_RAYDAT_REV:
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 082/103] ALSA: rme9652: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (80 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 081/103] ALSA: hdspm: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 083/103] ALSA: " Takashi Iwai
` (21 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/rme9652/rme9652.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 34d9c7995ddd..7dc8e3777c37 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -2364,7 +2364,7 @@ static int snd_rme9652_create_pcm(struct snd_card *card,
rme9652->pcm = pcm;
pcm->private_data = rme9652;
- strcpy(pcm->name, rme9652->card_name);
+ strscpy(pcm->name, rme9652->card_name);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_rme9652_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_rme9652_capture_ops);
@@ -2447,7 +2447,7 @@ static int snd_rme9652_create(struct snd_card *card,
switch (rev) {
case 8: /* original eprom */
- strcpy(card->driver, "RME9636");
+ strscpy(card->driver, "RME9636");
if (rme9652->hw_rev == 15) {
rme9652->card_name = "RME Digi9636 (Rev 1.5)";
} else {
@@ -2456,17 +2456,17 @@ static int snd_rme9652_create(struct snd_card *card,
rme9652->ss_channels = RME9636_NCHANNELS;
break;
case 9: /* W36_G EPROM */
- strcpy(card->driver, "RME9636");
+ strscpy(card->driver, "RME9636");
rme9652->card_name = "RME Digi9636 (Rev G)";
rme9652->ss_channels = RME9636_NCHANNELS;
break;
case 4: /* W52_G EPROM */
- strcpy(card->driver, "RME9652");
+ strscpy(card->driver, "RME9652");
rme9652->card_name = "RME Digi9652 (Rev G)";
rme9652->ss_channels = RME9652_NCHANNELS;
break;
case 3: /* original eprom */
- strcpy(card->driver, "RME9652");
+ strscpy(card->driver, "RME9652");
if (rme9652->hw_rev == 15) {
rme9652->card_name = "RME Digi9652 (Rev 1.5)";
} else {
@@ -2539,7 +2539,7 @@ static int snd_rme9652_probe(struct pci_dev *pci,
if (err)
goto error;
- strcpy(card->shortname, rme9652->card_name);
+ strscpy(card->shortname, rme9652->card_name);
sprintf(card->longname, "%s at 0x%lx, irq %d",
card->shortname, rme9652->port, rme9652->irq);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 083/103] ALSA: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (81 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 082/103] ALSA: rme9652: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 11:02 ` Geraldo Nascimento
2025-07-10 10:07 ` [PATCH 084/103] ALSA: sonicvibes: " Takashi Iwai
` (20 subsequent siblings)
103 siblings, 1 reply; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/sis7019.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index 42b22f123fa7..3d7abcb31679 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -868,7 +868,7 @@ static int sis_pcm_create(struct sis7019 *sis)
return rc;
pcm->private_data = sis;
- strcpy(pcm->name, "SiS7019");
+ strscpy(pcm->name, "SiS7019");
sis->pcm = pcm;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &sis_playback_ops);
@@ -1348,8 +1348,8 @@ static int __snd_sis7019_probe(struct pci_dev *pci,
if (rc < 0)
return rc;
- strcpy(card->driver, "SiS7019");
- strcpy(card->shortname, "SiS7019");
+ strscpy(card->driver, "SiS7019");
+ strscpy(card->shortname, "SiS7019");
rc = sis_chip_create(card, pci);
if (rc)
return rc;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 084/103] ALSA: sonicvibes: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (82 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 083/103] ALSA: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 085/103] ALSA: trident: " Takashi Iwai
` (19 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/sonicvibes.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 808a793ff4da..f85a9556dacb 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -863,7 +863,7 @@ static int snd_sonicvibes_pcm(struct sonicvibes *sonic, int device)
pcm->private_data = sonic;
pcm->info_flags = 0;
- strcpy(pcm->name, "S3 SonicVibes");
+ strscpy(pcm->name, "S3 SonicVibes");
sonic->pcm = pcm;
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -1091,7 +1091,7 @@ static int snd_sonicvibes_mixer(struct sonicvibes *sonic)
if (snd_BUG_ON(!sonic || !sonic->card))
return -EINVAL;
card = sonic->card;
- strcpy(card->mixername, "S3 SonicVibes");
+ strscpy(card->mixername, "S3 SonicVibes");
for (idx = 0; idx < ARRAY_SIZE(snd_sonicvibes_controls); idx++) {
kctl = snd_ctl_new1(&snd_sonicvibes_controls[idx], sonic);
@@ -1415,8 +1415,8 @@ static int __snd_sonic_probe(struct pci_dev *pci,
if (err < 0)
return err;
- strcpy(card->driver, "SonicVibes");
- strcpy(card->shortname, "S3 SonicVibes");
+ strscpy(card->driver, "SonicVibes");
+ strscpy(card->shortname, "S3 SonicVibes");
sprintf(card->longname, "%s rev %i at 0x%llx, irq %i",
card->shortname,
sonic->revision,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 085/103] ALSA: trident: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (83 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 084/103] ALSA: sonicvibes: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 086/103] ALSA: via82xx: " Takashi Iwai
` (18 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/trident/trident.c | 6 +++---
sound/pci/trident/trident_main.c | 14 +++++++-------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index 9922ab40798c..ddb6ccc72e44 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -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",
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 4e16b79d6584..39ed52bf8631 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -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,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 086/103] ALSA: via82xx: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (84 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 085/103] ALSA: trident: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 087/103] ALSA: ymfpci: " Takashi Iwai
` (17 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/via82xx.c | 20 ++++++++++----------
sound/pci/via82xx_modem.c | 4 ++--
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index a04dbc0a420f..0753c0c73f51 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -1436,7 +1436,7 @@ static int snd_via8233_pcm_new(struct via82xx *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via8233_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via8233_capture_ops);
pcm->private_data = chip;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcms[0] = pcm;
/* set up playbacks */
for (i = 0; i < 4; i++)
@@ -1461,7 +1461,7 @@ static int snd_via8233_pcm_new(struct via82xx *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via8233_multi_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via8233_capture_ops);
pcm->private_data = chip;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcms[1] = pcm;
/* set up playback */
init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 4, 0);
@@ -1504,7 +1504,7 @@ static int snd_via8233a_pcm_new(struct via82xx *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via8233_multi_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via8233_capture_ops);
pcm->private_data = chip;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcms[0] = pcm;
/* set up playback */
init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 4, 0);
@@ -1532,7 +1532,7 @@ static int snd_via8233a_pcm_new(struct via82xx *chip)
return err;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via8233_playback_ops);
pcm->private_data = chip;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcms[1] = pcm;
/* set up playback */
init_viadev(chip, chip->playback_devno, 0x30, 3, 0);
@@ -1562,7 +1562,7 @@ static int snd_via686_pcm_new(struct via82xx *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via686_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via686_capture_ops);
pcm->private_data = chip;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcms[0] = pcm;
init_viadev(chip, 0, VIA_REG_PLAYBACK_STATUS, 0, 0);
init_viadev(chip, 1, VIA_REG_CAPTURE_STATUS, 0, 1);
@@ -2461,7 +2461,7 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
card_type = pci_id->driver_data;
switch (card_type) {
case TYPE_CARD_VIA686:
- strcpy(card->driver, "VIA686A");
+ strscpy(card->driver, "VIA686A");
sprintf(card->shortname, "VIA 82C686A/B rev%x", pci->revision);
chip_type = TYPE_VIA686;
break;
@@ -2471,7 +2471,7 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
for (i = 0; i < ARRAY_SIZE(via823x_cards); i++) {
if (pci->revision == via823x_cards[i].revision) {
chip_type = via823x_cards[i].type;
- strcpy(card->shortname, via823x_cards[i].name);
+ strscpy(card->shortname, via823x_cards[i].name);
break;
}
}
@@ -2487,11 +2487,11 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
chip_type = TYPE_VIA8233;
}
if (chip_type == TYPE_VIA8233A)
- strcpy(card->driver, "VIA8233A");
+ strscpy(card->driver, "VIA8233A");
else if (pci->revision >= VIA_REV_8237)
- strcpy(card->driver, "VIA8237"); /* no slog assignment */
+ strscpy(card->driver, "VIA8237"); /* no slog assignment */
else
- strcpy(card->driver, "VIA8233");
+ strscpy(card->driver, "VIA8233");
break;
default:
dev_err(card->dev, "invalid card type %d\n", card_type);
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index eef0f9ddaae0..12a8c620724d 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -842,7 +842,7 @@ static int snd_via686_pcm_new(struct via82xx_modem *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via686_capture_ops);
pcm->dev_class = SNDRV_PCM_CLASS_MODEM;
pcm->private_data = chip;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcms[0] = pcm;
init_viadev(chip, 0, VIA_REG_MO_STATUS, 0);
init_viadev(chip, 1, VIA_REG_MI_STATUS, 1);
@@ -1116,7 +1116,7 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
card_type = pci_id->driver_data;
switch (card_type) {
case TYPE_CARD_VIA82XX_MODEM:
- strcpy(card->driver, "VIA82XX-MODEM");
+ strscpy(card->driver, "VIA82XX-MODEM");
sprintf(card->shortname, "VIA 82XX modem");
break;
default:
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 087/103] ALSA: ymfpci: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (85 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 086/103] ALSA: via82xx: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 088/103] ALSA: pdaudiocf: " Takashi Iwai
` (16 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pci/ymfpci/ymfpci.c | 2 +-
sound/pci/ymfpci/ymfpci_main.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 48444dda44de..764ca59e98d1 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -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,
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index d495f53a8324..75e013b66c5b 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -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;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 088/103] ALSA: pdaudiocf: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (86 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 087/103] ALSA: ymfpci: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 089/103] ALSA: vxpocket: " Takashi Iwai
` (15 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pcmcia/pdaudiocf/pdaudiocf.c | 2 +-
sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index 494460746614..13419837dfb7 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -160,7 +160,7 @@ static int snd_pdacf_assign_resources(struct snd_pdacf *pdacf, int port, int irq
if (err < 0)
return err;
- strcpy(card->driver, "PDAudio-CF");
+ strscpy(card->driver, "PDAudio-CF");
sprintf(card->shortname, "Core Sound %s", card->driver);
sprintf(card->longname, "%s at 0x%x, irq %i",
card->shortname, port, irq);
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index aaa82ec36540..20aba745f1dc 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -263,7 +263,7 @@ int snd_pdacf_pcm_new(struct snd_pdacf *chip)
pcm->private_data = chip;
pcm->info_flags = 0;
pcm->nonatomic = true;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcm = pcm;
err = snd_ak4117_build(chip->ak4117, pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 089/103] ALSA: vxpocket: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (87 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 088/103] ALSA: pdaudiocf: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 090/103] ALSA: ppc: " Takashi Iwai
` (14 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/pcmcia/vx/vxpocket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index d2d5f64d63b4..2e09f2a513a6 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -187,7 +187,7 @@ static int vxpocket_config(struct pcmcia_device *link)
/* overwrite the hardware information */
chip->hw = &vxp440_hw;
chip->type = vxp440_hw.type;
- strcpy(chip->card->driver, vxp440_hw.name);
+ strscpy(chip->card->driver, vxp440_hw.name);
}
ret = pcmcia_request_io(link);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 090/103] ALSA: ppc: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (88 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 089/103] ALSA: vxpocket: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 091/103] ALSA: sh: " Takashi Iwai
` (13 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/ppc/awacs.c | 2 +-
sound/ppc/burgundy.c | 2 +-
sound/ppc/daca.c | 2 +-
sound/ppc/pmac.c | 2 +-
sound/ppc/powermac.c | 8 ++++----
sound/ppc/snd_ps3.c | 8 ++++----
6 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 49399a4a290d..13a6f3af13ef 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -956,7 +956,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
/*
* build mixers
*/
- strcpy(chip->card->mixername, "PowerMac AWACS");
+ strscpy(chip->card->mixername, "PowerMac AWACS");
err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_mixers),
snd_pmac_awacs_mixers);
diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c
index 400a886562b1..ba15bc34c9ec 100644
--- a/sound/ppc/burgundy.c
+++ b/sound/ppc/burgundy.c
@@ -665,7 +665,7 @@ int snd_pmac_burgundy_init(struct snd_pmac *chip)
/*
* build burgundy mixers
*/
- strcpy(chip->card->mixername, "PowerMac Burgundy");
+ strscpy(chip->card->mixername, "PowerMac Burgundy");
for (i = 0; i < ARRAY_SIZE(snd_pmac_burgundy_mixers); i++) {
err = snd_ctl_add(chip->card,
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c
index d5766952f3db..a74114225b67 100644
--- a/sound/ppc/daca.c
+++ b/sound/ppc/daca.c
@@ -261,7 +261,7 @@ int snd_pmac_daca_init(struct snd_pmac *chip)
/*
* build mixers
*/
- strcpy(chip->card->mixername, "PowerMac DACA");
+ strscpy(chip->card->mixername, "PowerMac DACA");
for (i = 0; i < ARRAY_SIZE(daca_mixers); i++) {
err = snd_ctl_add(chip->card, snd_ctl_new1(&daca_mixers[i], chip));
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 76674c43fa7e..a3d346f1cc05 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -679,7 +679,7 @@ int snd_pmac_pcm_new(struct snd_pmac *chip)
pcm->private_data = chip;
pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
chip->pcm = pcm;
chip->formats_ok = SNDRV_PCM_FMTBIT_S16_BE;
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c
index f1b0cf9ea555..e685d245883e 100644
--- a/sound/ppc/powermac.c
+++ b/sound/ppc/powermac.c
@@ -55,8 +55,8 @@ static int snd_pmac_probe(struct platform_device *devptr)
switch (chip->model) {
case PMAC_BURGUNDY:
- strcpy(card->driver, "PMac Burgundy");
- strcpy(card->shortname, "PowerMac Burgundy");
+ strscpy(card->driver, "PMac Burgundy");
+ strscpy(card->shortname, "PowerMac Burgundy");
sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
card->shortname, chip->device_id, chip->subframe);
err = snd_pmac_burgundy_init(chip);
@@ -64,8 +64,8 @@ static int snd_pmac_probe(struct platform_device *devptr)
goto __error;
break;
case PMAC_DACA:
- strcpy(card->driver, "PMac DACA");
- strcpy(card->shortname, "PowerMac DACA");
+ strscpy(card->driver, "PMac DACA");
+ strscpy(card->shortname, "PowerMac DACA");
sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
card->shortname, chip->device_id, chip->subframe);
err = snd_pmac_daca_init(chip);
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
index a6cff2c46ac7..ce7ee2713f9d 100644
--- a/sound/ppc/snd_ps3.c
+++ b/sound/ppc/snd_ps3.c
@@ -951,9 +951,9 @@ static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
if (ret < 0)
goto clean_irq;
- strcpy(the_card.card->driver, "PS3");
- strcpy(the_card.card->shortname, "PS3");
- strcpy(the_card.card->longname, "PS3 sound");
+ strscpy(the_card.card->driver, "PS3");
+ strscpy(the_card.card->shortname, "PS3");
+ strscpy(the_card.card->longname, "PS3 sound");
/* create control elements */
for (i = 0; i < ARRAY_SIZE(spdif_ctls); i++) {
@@ -975,7 +975,7 @@ static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
goto clean_card;
the_card.pcm->private_data = &the_card;
- strcpy(the_card.pcm->name, "SPDIF");
+ strscpy(the_card.pcm->name, "SPDIF");
/* set pcm ops */
snd_pcm_set_ops(the_card.pcm, SNDRV_PCM_STREAM_PLAYBACK,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 091/103] ALSA: sh: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (89 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 090/103] ALSA: ppc: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 092/103] ALSA: sparc: " Takashi Iwai
` (12 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/sh/aica.c | 8 ++++----
sound/sh/sh_dac_audio.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 40ea843113a7..fa81bfba59c1 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -424,7 +424,7 @@ static int __init snd_aicapcmchip(struct snd_card_aica
if (unlikely(err < 0))
return err;
pcm->private_data = dreamcastcard;
- strcpy(pcm->name, "AICA PCM");
+ strscpy(pcm->name, "AICA PCM");
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_aicapcm_playback_ops);
/* Allocate the DMA buffers */
@@ -568,9 +568,9 @@ static int snd_aica_probe(struct platform_device *devptr)
kfree(dreamcastcard);
return err;
}
- strcpy(dreamcastcard->card->driver, "snd_aica");
- strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
- strcpy(dreamcastcard->card->longname,
+ strscpy(dreamcastcard->card->driver, "snd_aica");
+ strscpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
+ strscpy(dreamcastcard->card->longname,
"Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");
/* Prepare to use the queue */
INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma);
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index 84a4b17a0cc2..164f91240d02 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -224,7 +224,7 @@ static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)
return err;
pcm->private_data = chip;
- strcpy(pcm->name, "SH_DAC PCM");
+ strscpy(pcm->name, "SH_DAC PCM");
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops);
/* buffer size=48K */
@@ -358,8 +358,8 @@ static int snd_sh_dac_probe(struct platform_device *devptr)
if (err < 0)
goto probe_error;
- strcpy(card->driver, "snd_sh_dac");
- strcpy(card->shortname, "SuperH DAC audio driver");
+ strscpy(card->driver, "snd_sh_dac");
+ strscpy(card->shortname, "SuperH DAC audio driver");
dev_info(&devptr->dev, "%s %s\n", card->longname, card->shortname);
err = snd_card_register(card);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 092/103] ALSA: sparc: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (90 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 091/103] ALSA: sh: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 093/103] ALSA: spi: " Takashi Iwai
` (11 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/sparc/cs4231.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 1b44119edfbc..1a1fe3ceb76c 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -1230,7 +1230,7 @@ static int snd_cs4231_pcm(struct snd_card *card)
/* global setup */
pcm->private_data = chip;
pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
- strcpy(pcm->name, "CS4231");
+ strscpy(pcm->name, "CS4231");
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->op->dev, 64 * 1024, 128 * 1024);
@@ -1256,7 +1256,7 @@ static int snd_cs4231_timer(struct snd_card *card)
err = snd_timer_new(card, "CS4231", &tid, &timer);
if (err < 0)
return err;
- strcpy(timer->name, "CS4231");
+ strscpy(timer->name, "CS4231");
timer->private_data = chip;
timer->hw = snd_cs4231_timer_table;
chip->timer = timer;
@@ -1530,7 +1530,7 @@ static int snd_cs4231_mixer(struct snd_card *card)
if (snd_BUG_ON(!chip || !chip->pcm))
return -EINVAL;
- strcpy(card->mixername, chip->pcm->name);
+ strscpy(card->mixername, chip->pcm->name);
for (idx = 0; idx < ARRAY_SIZE(snd_cs4231_controls); idx++) {
err = snd_ctl_add(card,
@@ -1565,8 +1565,8 @@ static int cs4231_attach_begin(struct platform_device *op,
if (err < 0)
return err;
- strcpy(card->driver, "CS4231");
- strcpy(card->shortname, "Sun CS4231");
+ strscpy(card->driver, "CS4231");
+ strscpy(card->shortname, "Sun CS4231");
chip = card->private_data;
chip->card = card;
@@ -1964,12 +1964,12 @@ static int snd_cs4231_ebus_create(struct snd_card *card,
chip->op = op;
memcpy(&chip->image, &snd_cs4231_original_image,
sizeof(snd_cs4231_original_image));
- strcpy(chip->c_dma.ebus_info.name, "cs4231(capture)");
+ strscpy(chip->c_dma.ebus_info.name, "cs4231(capture)");
chip->c_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER;
chip->c_dma.ebus_info.callback = snd_cs4231_ebus_capture_callback;
chip->c_dma.ebus_info.client_cookie = chip;
chip->c_dma.ebus_info.irq = op->archdata.irqs[0];
- strcpy(chip->p_dma.ebus_info.name, "cs4231(play)");
+ strscpy(chip->p_dma.ebus_info.name, "cs4231(play)");
chip->p_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER;
chip->p_dma.ebus_info.callback = snd_cs4231_ebus_play_callback;
chip->p_dma.ebus_info.client_cookie = chip;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 093/103] ALSA: spi: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (91 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 092/103] ALSA: sparc: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 094/103] ALSA: synth: " Takashi Iwai
` (10 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/spi/at73c213.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index 8f6929ced2c8..a0a7f90b6146 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -336,7 +336,7 @@ static int snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device)
pcm->private_data = chip;
pcm->info_flags = SNDRV_PCM_INFO_BLOCK_TRANSFER;
- strcpy(pcm->name, "at73c213");
+ strscpy(pcm->name, "at73c213");
chip->pcm = pcm;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &at73c213_playback_ops);
@@ -713,7 +713,7 @@ static int snd_at73c213_mixer(struct snd_at73c213 *chip)
card = chip->card;
- strcpy(card->mixername, chip->pcm->name);
+ strscpy(card->mixername, chip->pcm->name);
for (idx = 0; idx < ARRAY_SIZE(snd_at73c213_controls); idx++) {
errval = snd_ctl_add(card,
@@ -983,8 +983,8 @@ static int snd_at73c213_probe(struct spi_device *spi)
if (retval)
goto out_ssc;
- strcpy(card->driver, "at73c213");
- strcpy(card->shortname, board->shortname);
+ strscpy(card->driver, "at73c213");
+ strscpy(card->shortname, board->shortname);
sprintf(card->longname, "%s on irq %d", card->shortname, chip->irq);
retval = snd_card_register(card);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 094/103] ALSA: synth: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (92 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 093/103] ALSA: spi: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 095/103] ALSA: 6fire: " Takashi Iwai
` (9 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/synth/emux/emux_hwdep.c | 2 +-
sound/synth/emux/emux_oss.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c
index 9e98c4c73fd1..14b990cf3b22 100644
--- a/sound/synth/emux/emux_hwdep.c
+++ b/sound/synth/emux/emux_hwdep.c
@@ -121,7 +121,7 @@ snd_emux_init_hwdep(struct snd_emux *emu)
if (err < 0)
return err;
emu->hwdep = hw;
- strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME);
+ strscpy(hw->name, SNDRV_EMUX_HWDEP_NAME);
hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE;
hw->ops.ioctl = snd_emux_hwdep_ioctl;
/* The ioctl parameter types are compatible between 32- and
diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c
index 5f98d5201ba2..1145c7956afd 100644
--- a/sound/synth/emux/emux_oss.c
+++ b/sound/synth/emux/emux_oss.c
@@ -60,7 +60,7 @@ snd_emux_init_seq_oss(struct snd_emux *emu)
return;
emu->oss_synth = dev;
- strcpy(dev->name, emu->name);
+ strscpy(dev->name, emu->name);
arg = SNDRV_SEQ_DEVICE_ARGPTR(dev);
arg->type = SYNTH_TYPE_SAMPLE;
arg->subtype = SAMPLE_TYPE_AWE32;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 095/103] ALSA: 6fire: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (93 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 094/103] ALSA: synth: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 096/103] ALSA: line6: " Takashi Iwai
` (8 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/usb/6fire/chip.c | 4 ++--
sound/usb/6fire/midi.c | 2 +-
sound/usb/6fire/pcm.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c
index d562a30b087f..9eb4bf9b138b 100644
--- a/sound/usb/6fire/chip.c
+++ b/sound/usb/6fire/chip.c
@@ -125,8 +125,8 @@ static int usb6fire_chip_probe(struct usb_interface *intf,
dev_err(&intf->dev, "cannot create alsa card.\n");
return ret;
}
- strcpy(card->driver, "6FireUSB");
- strcpy(card->shortname, "TerraTec DMX6FireUSB");
+ strscpy(card->driver, "6FireUSB");
+ strscpy(card->shortname, "TerraTec DMX6FireUSB");
sprintf(card->longname, "%s at %d:%d", card->shortname,
device->bus->busnum, device->devnum);
diff --git a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c
index de2691d58de6..923f7767e62f 100644
--- a/sound/usb/6fire/midi.c
+++ b/sound/usb/6fire/midi.c
@@ -183,7 +183,7 @@ int usb6fire_midi_init(struct sfire_chip *chip)
return ret;
}
rt->instance->private_data = rt;
- strcpy(rt->instance->name, "DMX6FireUSB MIDI");
+ strscpy(rt->instance->name, "DMX6FireUSB MIDI");
rt->instance->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT |
SNDRV_RAWMIDI_INFO_INPUT |
SNDRV_RAWMIDI_INFO_DUPLEX;
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 32c39d8bd2e5..d53cad97889a 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -640,7 +640,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
}
pcm->private_data = rt;
- strcpy(pcm->name, "DMX 6Fire USB");
+ strscpy(pcm->name, "DMX 6Fire USB");
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops);
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 096/103] ALSA: line6: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (94 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 095/103] ALSA: 6fire: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 097/103] ALSA: usx2y: " Takashi Iwai
` (7 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/usb/line6/driver.c | 8 ++++----
sound/usb/line6/midi.c | 4 ++--
sound/usb/line6/pcm.c | 2 +-
sound/usb/line6/toneport.c | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index e9eb5c74d6c7..f2f9261489a2 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -678,7 +678,7 @@ static int line6_hwdep_init(struct usb_line6 *line6)
err = snd_hwdep_new(line6->card, "config", 0, &hwdep);
if (err < 0)
goto end;
- strcpy(hwdep->name, "config");
+ strscpy(hwdep->name, "config");
hwdep->iface = SNDRV_HWDEP_IFACE_LINE6;
hwdep->ops = hwdep_ops;
hwdep->private_data = line6;
@@ -770,9 +770,9 @@ int line6_probe(struct usb_interface *interface,
line6->ifcdev = &interface->dev;
INIT_DELAYED_WORK(&line6->startup_work, line6_startup_work);
- strcpy(card->id, properties->id);
- strcpy(card->driver, driver_name);
- strcpy(card->shortname, properties->name);
+ strscpy(card->id, properties->id);
+ strscpy(card->driver, driver_name);
+ strscpy(card->shortname, properties->name);
sprintf(card->longname, "Line 6 %s at USB %s", properties->name,
dev_name(line6->ifcdev));
card->private_free = line6_destruct;
diff --git a/sound/usb/line6/midi.c b/sound/usb/line6/midi.c
index 9b5176086280..1d77794b4490 100644
--- a/sound/usb/line6/midi.c
+++ b/sound/usb/line6/midi.c
@@ -228,8 +228,8 @@ static int snd_line6_new_midi(struct usb_line6 *line6,
return err;
rmidi = *rmidi_ret;
- strcpy(rmidi->id, line6->properties->id);
- strcpy(rmidi->name, line6->properties->name);
+ strscpy(rmidi->id, line6->properties->id);
+ strscpy(rmidi->name, line6->properties->name);
rmidi->info_flags =
SNDRV_RAWMIDI_INFO_OUTPUT |
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c
index d4dbbc432505..c1e2a8ab66fa 100644
--- a/sound/usb/line6/pcm.c
+++ b/sound/usb/line6/pcm.c
@@ -486,7 +486,7 @@ static int snd_line6_new_pcm(struct usb_line6 *line6, struct snd_pcm **pcm_ret)
if (err < 0)
return err;
pcm = *pcm_ret;
- strcpy(pcm->name, line6->properties->name);
+ strscpy(pcm->name, line6->properties->name);
/* set operators */
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index c073b38cd673..68cda7bf330c 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -199,7 +199,7 @@ static int snd_toneport_source_info(struct snd_kcontrol *kcontrol,
if (uinfo->value.enumerated.item >= size)
uinfo->value.enumerated.item = size - 1;
- strcpy(uinfo->value.enumerated.name,
+ strscpy(uinfo->value.enumerated.name,
toneport_source_info[uinfo->value.enumerated.item].name);
return 0;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 097/103] ALSA: usx2y: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (95 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 096/103] ALSA: line6: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 098/103] ALSA: ua101: " Takashi Iwai
` (6 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/usb/usx2y/us122l.c | 2 +-
sound/usb/usx2y/usX2Yhwdep.c | 2 +-
sound/usb/usx2y/usbusx2y.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index 6bcf8b859ebb..2ace3ba46091 100644
--- a/sound/usb/usx2y/us122l.c
+++ b/sound/usb/usx2y/us122l.c
@@ -495,7 +495,7 @@ static int usx2y_create_card(struct usb_device *device,
init_waitqueue_head(&US122L(card)->sk.sleep);
US122L(card)->is_us144 = flags & US122L_FLAG_US144;
INIT_LIST_HEAD(&US122L(card)->midi_list);
- strcpy(card->driver, "USB "NAME_ALLCAPS"");
+ strscpy(card->driver, "USB "NAME_ALLCAPS"");
sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
card->shortname,
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 9fd6a86cc08e..4d7925184826 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -102,7 +102,7 @@ static int snd_usx2y_hwdep_dsp_status(struct snd_hwdep *hw,
}
if (id < 0)
return -ENODEV;
- strcpy(info->id, type_ids[id]);
+ strscpy(info->id, type_ids[id]);
info->num_dsps = 2; // 0: Prepad Data, 1: FPGA Code
if (us428->chip_status & USX2Y_STAT_CHIP_INIT)
info->chip_ready = 1;
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index 5756ff3528a2..f34e78910200 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -382,7 +382,7 @@ static int usx2y_create_card(struct usb_device *device,
init_waitqueue_head(&usx2y(card)->us428ctls_wait_queue_head);
mutex_init(&usx2y(card)->pcm_mutex);
INIT_LIST_HEAD(&usx2y(card)->midi_list);
- strcpy(card->driver, "USB "NAME_ALLCAPS"");
+ strscpy(card->driver, "USB "NAME_ALLCAPS"");
sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
card->shortname,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 098/103] ALSA: ua101: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (96 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 097/103] ALSA: usx2y: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 099/103] ALSA: usb-audio: " Takashi Iwai
` (5 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/usb/misc/ua101.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index 4f6b20ed29dd..e200e4af799c 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -1246,8 +1246,8 @@ static int ua101_probe(struct usb_interface *interface,
goto probe_error;
name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101";
- strcpy(card->driver, "UA-101");
- strcpy(card->shortname, name);
+ strscpy(card->driver, "UA-101");
+ strscpy(card->shortname, name);
usb_make_path(ua->dev, usb_path, sizeof(usb_path));
snprintf(ua->card->longname, sizeof(ua->card->longname),
"EDIROL %s (serial %s), %u Hz at %s, %s speed", name,
@@ -1272,7 +1272,7 @@ static int ua101_probe(struct usb_interface *interface,
if (err < 0)
goto probe_error;
ua->pcm->private_data = ua;
- strcpy(ua->pcm->name, name);
+ strscpy(ua->pcm->name, name);
snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops);
snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops);
snd_pcm_set_managed_buffer_all(ua->pcm, SNDRV_DMA_TYPE_VMALLOC,
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 099/103] ALSA: usb-audio: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (97 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 098/103] ALSA: ua101: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 100/103] ALSA: ac97: Copy string more safely Takashi Iwai
` (4 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
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>
---
sound/usb/card.c | 2 +-
sound/usb/midi.c | 2 +-
sound/usb/mixer.c | 2 +-
sound/usb/stream.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 9fb8726a6c93..630ce40ed2c9 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -756,7 +756,7 @@ static int snd_usb_audio_create(struct usb_interface *intf,
card->private_free = snd_usb_audio_free;
- strcpy(card->driver, "USB-Audio");
+ strscpy(card->driver, "USB-Audio");
sprintf(component, "USB%04x:%04x",
USB_ID_VENDOR(chip->usb_id), USB_ID_PRODUCT(chip->usb_id));
snd_component_add(card, component);
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 866e613fee4f..acb3bf92857c 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -2407,7 +2407,7 @@ static int snd_usbmidi_create_rawmidi(struct snd_usb_midi *umidi,
out_ports, in_ports, &rmidi);
if (err < 0)
return err;
- strcpy(rmidi->name, umidi->card->shortname);
+ strscpy(rmidi->name, umidi->card->shortname);
rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT |
SNDRV_RAWMIDI_INFO_INPUT |
SNDRV_RAWMIDI_INFO_DUPLEX;
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 11be79af26db..a7cd7d51e66b 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -3569,7 +3569,7 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif)
struct usb_mixer_interface *mixer;
int err;
- strcpy(chip->card->mixername, "USB Mixer");
+ strscpy(chip->card->mixername, "USB Mixer");
mixer = kzalloc(sizeof(*mixer), GFP_KERNEL);
if (!mixer)
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index aa91d63749f2..749498fbf9cb 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -538,7 +538,7 @@ static int __snd_usb_add_audio_stream(struct snd_usb_audio *chip,
if (chip->pcm_devs > 0)
sprintf(pcm->name, "USB Audio #%d", chip->pcm_devs);
else
- strcpy(pcm->name, "USB Audio");
+ strscpy(pcm->name, "USB Audio");
snd_usb_init_substream(as, stream, fp, pd);
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 100/103] ALSA: ac97: Copy string more safely
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (98 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 099/103] ALSA: usb-audio: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 101/103] ALSA: cmipci: " Takashi Iwai
` (3 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
snd_ac97_get_name() blindly assumes that the name buffer is large
enough, but we should be more careful. Pass the max buffer length and
allow trimming to the size.
Only a cosmetic safety matter, no functional changes intended.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/ac97/ac97_codec.c | 19 +++++++++++--------
sound/pci/ac97/ac97_local.h | 2 +-
sound/pci/ac97/ac97_proc.c | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 588c094080be..cd60c856a92e 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1840,7 +1840,8 @@ static const struct ac97_codec_id *look_for_codec_id(const struct ac97_codec_id
return NULL;
}
-void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name, int modem)
+void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name,
+ size_t maxlen, int modem)
{
const struct ac97_codec_id *pid;
@@ -1852,7 +1853,7 @@ void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name, int m
if (! pid)
return;
- strcpy(name, pid->name);
+ strscpy(name, pid->name, maxlen);
if (ac97 && pid->patch) {
if ((modem && (pid->flags & AC97_MODEM_PATCH)) ||
(! modem && ! (pid->flags & AC97_MODEM_PATCH)))
@@ -1861,8 +1862,8 @@ void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name, int m
pid = look_for_codec_id(snd_ac97_codec_ids, id);
if (pid) {
- strcat(name, " ");
- strcat(name, pid->name);
+ strlcat(name, " ", maxlen);
+ strlcat(name, pid->name, maxlen);
if (pid->mask != 0xffffffff)
sprintf(name + strlen(name), " rev %u", id & ~pid->mask);
if (ac97 && pid->patch) {
@@ -1870,8 +1871,10 @@ void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name, int m
(! modem && ! (pid->flags & AC97_MODEM_PATCH)))
pid->patch(ac97);
}
- } else
- sprintf(name + strlen(name), " id %x", id & 0xff);
+ } else {
+ int l = strlen(name);
+ snprintf(name + l, maxlen - l, " id %x", id & 0xff);
+ }
}
/**
@@ -2295,8 +2298,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
/* additional initializations */
if (bus->ops->init)
bus->ops->init(ac97);
- snd_ac97_get_name(ac97, ac97->id, name, !ac97_is_audio(ac97));
- snd_ac97_get_name(NULL, ac97->id, name, !ac97_is_audio(ac97)); // ac97->id might be changed in the special setup code
+ snd_ac97_get_name(ac97, ac97->id, name, sizeof(name), !ac97_is_audio(ac97));
+ snd_ac97_get_name(NULL, ac97->id, name, sizeof(name), !ac97_is_audio(ac97)); // ac97->id might be changed in the special setup code
if (! ac97->build_ops)
ac97->build_ops = &null_build_ops;
diff --git a/sound/pci/ac97/ac97_local.h b/sound/pci/ac97/ac97_local.h
index 8eeae2dec552..965284eb4b33 100644
--- a/sound/pci/ac97/ac97_local.h
+++ b/sound/pci/ac97/ac97_local.h
@@ -8,7 +8,7 @@
*/
void snd_ac97_get_name(struct snd_ac97 *ac97, unsigned int id, char *name,
- int modem);
+ size_t maxlen, int modem);
int snd_ac97_update_bits_nolock(struct snd_ac97 *ac97, unsigned short reg,
unsigned short mask, unsigned short value);
diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c
index 518834964b7b..2df3ba9a08dc 100644
--- a/sound/pci/ac97/ac97_proc.c
+++ b/sound/pci/ac97/ac97_proc.c
@@ -98,7 +98,7 @@ static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffe
static const char *spdif_rates_cs4205[4] = { " Rate=48kHz", " Rate=44.1kHz", " Rate=res", " Rate=res" };
static const char *double_rate_slots[4] = { "10/11", "7/8", "reserved", "reserved" };
- snd_ac97_get_name(NULL, ac97->id, name, 0);
+ snd_ac97_get_name(NULL, ac97->id, name, sizeof(name), 0);
snd_iprintf(buffer, "%d-%d/%d: %s\n\n", ac97->addr, ac97->num, subidx, name);
if ((ac97->scaps & AC97_SCAP_AUDIO) == 0)
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 101/103] ALSA: cmipci: Copy string more safely
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (99 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 100/103] ALSA: ac97: Copy string more safely Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 102/103] ALSA: usb-audio: " Takashi Iwai
` (2 subsequent siblings)
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
The probe code uses sprintf() and strcat() without caring about the
string buffer size. Replace with safer code.
Only a cosmetic safety matter, no functional changes intended.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/cmipci.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 9056214e9cda..c4ee550d7c96 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -3008,11 +3008,12 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,
pci->device != PCI_DEVICE_ID_CMEDIA_CM8338B)
query_chip(cm);
/* added -MCx suffix for chip supporting multi-channels */
- if (cm->can_multi_ch)
- sprintf(cm->card->driver + strlen(cm->card->driver),
- "-MC%d", cm->max_channels);
- else if (cm->can_ac3_sw)
- strcpy(cm->card->driver + strlen(cm->card->driver), "-SWIEC");
+ if (cm->can_multi_ch) {
+ int l = strlen(cm->card->driver);
+ scnprintf(cm->card->driver + l, sizeof(cm->card->driver) - l,
+ "-MC%d", cm->max_channels);
+ } else if (cm->can_ac3_sw)
+ strlcat(cm->card->driver, "-SWIEC", sizeof(cm->card->driver));
cm->dig_status = SNDRV_PCM_DEFAULT_CON_SPDIF;
cm->dig_pcm_status = SNDRV_PCM_DEFAULT_CON_SPDIF;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 102/103] ALSA: usb-audio: Copy string more safely
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (100 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 101/103] ALSA: cmipci: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 103/103] ALSA: core: " Takashi Iwai
2025-07-10 12:37 ` [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Sakamoto
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
Replace strcpy() and sprintf() usages in the USB audio drivers with
the safer versions (strscpy() and scnprintf()) with the proper max
size evaluation. Only for safety, no actual behavior change.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/usb/card.c | 11 ++++++-----
sound/usb/midi2.c | 3 ++-
sound/usb/mixer.c | 22 +++++++++++-----------
sound/usb/mixer_scarlett.c | 31 ++++++++++++++++++-------------
sound/usb/mixer_scarlett2.c | 14 ++++++++------
sound/usb/proc.c | 2 +-
sound/usb/stream.c | 3 ++-
7 files changed, 48 insertions(+), 38 deletions(-)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 630ce40ed2c9..10d9b7285597 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -616,9 +616,10 @@ static void usb_audio_make_shortname(struct usb_device *dev,
usb_string(dev, dev->descriptor.iProduct,
card->shortname, sizeof(card->shortname)) <= 0) {
/* no name available from anywhere, so use ID */
- sprintf(card->shortname, "USB Device %#04x:%#04x",
- USB_ID_VENDOR(chip->usb_id),
- USB_ID_PRODUCT(chip->usb_id));
+ scnprintf(card->shortname, sizeof(card->shortname),
+ "USB Device %#04x:%#04x",
+ USB_ID_VENDOR(chip->usb_id),
+ USB_ID_PRODUCT(chip->usb_id));
}
strim(card->shortname);
@@ -757,8 +758,8 @@ static int snd_usb_audio_create(struct usb_interface *intf,
card->private_free = snd_usb_audio_free;
strscpy(card->driver, "USB-Audio");
- sprintf(component, "USB%04x:%04x",
- USB_ID_VENDOR(chip->usb_id), USB_ID_PRODUCT(chip->usb_id));
+ scnprintf(component, sizeof(component), "USB%04x:%04x",
+ USB_ID_VENDOR(chip->usb_id), USB_ID_PRODUCT(chip->usb_id));
snd_component_add(card, component);
usb_audio_make_shortname(dev, chip, quirk);
diff --git a/sound/usb/midi2.c b/sound/usb/midi2.c
index 692dfc3c182f..030569fda416 100644
--- a/sound/usb/midi2.c
+++ b/sound/usb/midi2.c
@@ -1058,7 +1058,8 @@ static void set_fallback_rawmidi_names(struct snd_usb_midi2_interface *umidi)
fill_ump_ep_name(ump, dev, dev->descriptor.iProduct);
/* fill fallback name */
if (!*ump->info.name)
- sprintf(ump->info.name, "USB MIDI %d", rmidi->index);
+ scnprintf(ump->info.name, sizeof(ump->info.name),
+ "USB MIDI %d", rmidi->index);
/* copy as rawmidi name if not set */
if (!*ump->core.name)
strscpy(ump->core.name, ump->info.name,
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index a7cd7d51e66b..63b300bc67ba 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -674,40 +674,40 @@ static int get_term_name(struct snd_usb_audio *chip, struct usb_audio_term *iter
return 0;
switch (iterm->type >> 16) {
case UAC3_SELECTOR_UNIT:
- strcpy(name, "Selector");
+ strscpy(name, "Selector", maxlen);
return 8;
case UAC3_PROCESSING_UNIT:
- strcpy(name, "Process Unit");
+ strscpy(name, "Process Unit", maxlen);
return 12;
case UAC3_EXTENSION_UNIT:
- strcpy(name, "Ext Unit");
+ strscpy(name, "Ext Unit", maxlen);
return 8;
case UAC3_MIXER_UNIT:
- strcpy(name, "Mixer");
+ strscpy(name, "Mixer", maxlen);
return 5;
default:
- return sprintf(name, "Unit %d", iterm->id);
+ return scnprintf(name, maxlen, "Unit %d", iterm->id);
}
}
switch (iterm->type & 0xff00) {
case 0x0100:
- strcpy(name, "PCM");
+ strscpy(name, "PCM", maxlen);
return 3;
case 0x0200:
- strcpy(name, "Mic");
+ strscpy(name, "Mic", maxlen);
return 3;
case 0x0400:
- strcpy(name, "Headset");
+ strscpy(name, "Headset", maxlen);
return 7;
case 0x0500:
- strcpy(name, "Phone");
+ strscpy(name, "Phone", maxlen);
return 5;
}
for (names = iterm_names; names->type; names++) {
if (names->type == iterm->type) {
- strcpy(name, names->name);
+ strscpy(name, names->name, maxlen);
return strlen(names->name);
}
}
@@ -2804,7 +2804,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
len = get_term_name(state->chip, &iterm, namelist[i],
MAX_ITEM_NAME_LEN, 0);
if (! len)
- sprintf(namelist[i], "Input %u", i);
+ scnprintf(namelist[i], MAX_ITEM_NAME_LEN, "Input %u", i);
}
kctl = snd_ctl_new1(&mixer_selectunit_ctl, cval);
diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index ff548041679b..8babfa3f7c45 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -357,21 +357,21 @@ static int scarlett_ctl_put(struct snd_kcontrol *kctl,
return changed;
}
-static void scarlett_generate_name(int i, char *dst, int offsets[])
+static void scarlett_generate_name(int i, char *dst, size_t size, int offsets[])
{
if (i > offsets[SCARLETT_OFFSET_MIX])
- sprintf(dst, "Mix %c",
- 'A'+(i - offsets[SCARLETT_OFFSET_MIX] - 1));
+ scnprintf(dst, size, "Mix %c",
+ 'A'+(i - offsets[SCARLETT_OFFSET_MIX] - 1));
else if (i > offsets[SCARLETT_OFFSET_ADAT])
- sprintf(dst, "ADAT %d", i - offsets[SCARLETT_OFFSET_ADAT]);
+ scnprintf(dst, size, "ADAT %d", i - offsets[SCARLETT_OFFSET_ADAT]);
else if (i > offsets[SCARLETT_OFFSET_SPDIF])
- sprintf(dst, "SPDIF %d", i - offsets[SCARLETT_OFFSET_SPDIF]);
+ scnprintf(dst, size, "SPDIF %d", i - offsets[SCARLETT_OFFSET_SPDIF]);
else if (i > offsets[SCARLETT_OFFSET_ANALOG])
- sprintf(dst, "Analog %d", i - offsets[SCARLETT_OFFSET_ANALOG]);
+ scnprintf(dst, size, "Analog %d", i - offsets[SCARLETT_OFFSET_ANALOG]);
else if (i > offsets[SCARLETT_OFFSET_PCM])
- sprintf(dst, "PCM %d", i - offsets[SCARLETT_OFFSET_PCM]);
+ scnprintf(dst, size, "PCM %d", i - offsets[SCARLETT_OFFSET_PCM]);
else
- sprintf(dst, "Off");
+ scnprintf(dst, size, "Off");
}
static int scarlett_ctl_enum_dynamic_info(struct snd_kcontrol *kctl,
@@ -391,6 +391,7 @@ static int scarlett_ctl_enum_dynamic_info(struct snd_kcontrol *kctl,
/* generate name dynamically based on item number and offset info */
scarlett_generate_name(uinfo->value.enumerated.item,
uinfo->value.enumerated.name,
+ sizeof(uinfo->value.enumerated.name),
opt->offsets);
return 0;
@@ -876,7 +877,8 @@ static int scarlett_controls_create_generic(struct usb_mixer_interface *mixer,
return err;
break;
case SCARLETT_SWITCH_IMPEDANCE:
- sprintf(mx, "Input %d Impedance Switch", ctl->num);
+ scnprintf(mx, sizeof(mx),
+ "Input %d Impedance Switch", ctl->num);
err = add_new_ctl(mixer, &usb_scarlett_ctl_enum,
scarlett_ctl_enum_resume, 0x01,
0x09, ctl->num, USB_MIXER_S16, 1, mx,
@@ -885,7 +887,8 @@ static int scarlett_controls_create_generic(struct usb_mixer_interface *mixer,
return err;
break;
case SCARLETT_SWITCH_PAD:
- sprintf(mx, "Input %d Pad Switch", ctl->num);
+ scnprintf(mx, sizeof(mx),
+ "Input %d Pad Switch", ctl->num);
err = add_new_ctl(mixer, &usb_scarlett_ctl_enum,
scarlett_ctl_enum_resume, 0x01,
0x0b, ctl->num, USB_MIXER_S16, 1, mx,
@@ -894,7 +897,8 @@ static int scarlett_controls_create_generic(struct usb_mixer_interface *mixer,
return err;
break;
case SCARLETT_SWITCH_GAIN:
- sprintf(mx, "Input %d Gain Switch", ctl->num);
+ scnprintf(mx, sizeof(mx),
+ "Input %d Gain Switch", ctl->num);
err = add_new_ctl(mixer, &usb_scarlett_ctl_enum,
scarlett_ctl_enum_resume, 0x01,
0x08, ctl->num, USB_MIXER_S16, 1, mx,
@@ -960,8 +964,9 @@ int snd_scarlett_controls_create(struct usb_mixer_interface *mixer)
return err;
for (o = 0; o < info->matrix_out; o++) {
- sprintf(mx, "Matrix %02d Mix %c Playback Volume", i+1,
- o+'A');
+ scnprintf(mx, sizeof(mx),
+ "Matrix %02d Mix %c Playback Volume", i+1,
+ o+'A');
err = add_new_ctl(mixer, &usb_scarlett_ctl,
scarlett_ctl_resume, 0x3c, 0x00,
(i << 3) + (o & 0x07), USB_MIXER_S16,
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index 93589e86828a..49eeb1444dce 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -7396,13 +7396,15 @@ static int scarlett2_mux_src_enum_ctl_info(struct snd_kcontrol *kctl,
if (port_type == SCARLETT2_PORT_TYPE_MIX &&
item >= private->num_mix_out)
- sprintf(uinfo->value.enumerated.name,
- port->dsp_src_descr,
- item - private->num_mix_out + 1);
+ scnprintf(uinfo->value.enumerated.name,
+ sizeof(uinfo->value.enumerated.name),
+ port->dsp_src_descr,
+ item - private->num_mix_out + 1);
else
- sprintf(uinfo->value.enumerated.name,
- port->src_descr,
- item + port->src_num_offset);
+ scnprintf(uinfo->value.enumerated.name,
+ sizeof(uinfo->value.enumerated.name),
+ port->src_descr,
+ item + port->src_num_offset);
return 0;
}
diff --git a/sound/usb/proc.c b/sound/usb/proc.c
index e9bbaea7b2fa..c8b967bd7065 100644
--- a/sound/usb/proc.c
+++ b/sound/usb/proc.c
@@ -231,7 +231,7 @@ void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream)
char name[32];
struct snd_card *card = stream->chip->card;
- sprintf(name, "stream%d", stream->pcm_index);
+ scnprintf(name, sizeof(name), "stream%d", stream->pcm_index);
snd_card_ro_proc_new(card, name, stream, proc_pcm_format_read);
}
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 749498fbf9cb..ad6ced780634 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -536,7 +536,8 @@ static int __snd_usb_add_audio_stream(struct snd_usb_audio *chip,
pcm->private_free = snd_usb_audio_pcm_free;
pcm->info_flags = 0;
if (chip->pcm_devs > 0)
- sprintf(pcm->name, "USB Audio #%d", chip->pcm_devs);
+ scnprintf(pcm->name, sizeof(pcm->name), "USB Audio #%d",
+ chip->pcm_devs);
else
strscpy(pcm->name, "USB Audio");
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* [PATCH 103/103] ALSA: core: Copy string more safely
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (101 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 102/103] ALSA: usb-audio: " Takashi Iwai
@ 2025-07-10 10:07 ` Takashi Iwai
2025-07-10 12:37 ` [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Sakamoto
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 10:07 UTC (permalink / raw)
To: linux-sound
Replace the remaining strcpy() and sprintf() usages in the ALSA core
code with the safer versions.
The first strcpy() points actually to card->id, hence just use
strscpy() with card->id instead.
The append of suffix string is slightly rewritten so that we can use
scnprintf() and strscpy().
Only for safety, no actual behavior change.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/init.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/sound/core/init.c b/sound/core/init.c
index 114fb87de990..c372b3228785 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -723,27 +723,25 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src,
* ("card" conflicts with proc directories)
*/
if (!*id || !strncmp(id, "card", 4)) {
- strcpy(id, "Default");
+ strscpy(card->id, "Default");
is_default = true;
}
len = strlen(id);
for (loops = 0; loops < SNDRV_CARDS; loops++) {
- char *spos;
char sfxstr[5]; /* "_012" */
- int sfxlen;
+ int sfxlen, slen;
if (card_id_ok(card, id))
return; /* OK */
/* Add _XYZ suffix */
- sprintf(sfxstr, "_%X", loops + 1);
- sfxlen = strlen(sfxstr);
+ sfxlen = scnprintf(sfxstr, sizeof(sfxstr), "_%X", loops + 1);
if (len + sfxlen >= sizeof(card->id))
- spos = id + sizeof(card->id) - sfxlen - 1;
+ slen = sizeof(card->id) - sfxlen - 1;
else
- spos = id + len;
- strcpy(spos, sfxstr);
+ slen = len;
+ strscpy(id + slen, sfxstr, sizeof(card->id) - slen);
}
/* fallback to the default id */
if (!is_default) {
@@ -801,7 +799,7 @@ static ssize_t id_store(struct device *dev, struct device_attribute *attr,
guard(mutex)(&snd_card_mutex);
if (!card_id_ok(NULL, buf1))
return -EEXIST;
- strcpy(card->id, buf1);
+ strscpy(card->id, buf1);
snd_info_card_id_change(card);
return count;
--
2.50.0
^ permalink raw reply related [flat|nested] 112+ messages in thread
* Re: [PATCH 083/103] ALSA: Use safer strscpy() instead of strcpy()
2025-07-10 10:07 ` [PATCH 083/103] ALSA: " Takashi Iwai
@ 2025-07-10 11:02 ` Geraldo Nascimento
2025-07-10 11:20 ` Takashi Iwai
0 siblings, 1 reply; 112+ messages in thread
From: Geraldo Nascimento @ 2025-07-10 11:02 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-sound
On Thu, Jul 10, 2025 at 12:07:05PM +0200, Takashi Iwai wrote:
> 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>
> ---
> sound/pci/sis7019.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
Hi Takashi,
I think you've missed the "sis7019: " after "ALSA: " on the subject line
for this one.
Regards,
Geraldo Nascimento
> index 42b22f123fa7..3d7abcb31679 100644
> --- a/sound/pci/sis7019.c
> +++ b/sound/pci/sis7019.c
> @@ -868,7 +868,7 @@ static int sis_pcm_create(struct sis7019 *sis)
> return rc;
>
> pcm->private_data = sis;
> - strcpy(pcm->name, "SiS7019");
> + strscpy(pcm->name, "SiS7019");
> sis->pcm = pcm;
>
> snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &sis_playback_ops);
> @@ -1348,8 +1348,8 @@ static int __snd_sis7019_probe(struct pci_dev *pci,
> if (rc < 0)
> return rc;
>
> - strcpy(card->driver, "SiS7019");
> - strcpy(card->shortname, "SiS7019");
> + strscpy(card->driver, "SiS7019");
> + strscpy(card->shortname, "SiS7019");
> rc = sis_chip_create(card, pci);
> if (rc)
> return rc;
> --
> 2.50.0
>
>
^ permalink raw reply [flat|nested] 112+ messages in thread
* Re: [PATCH 083/103] ALSA: Use safer strscpy() instead of strcpy()
2025-07-10 11:02 ` Geraldo Nascimento
@ 2025-07-10 11:20 ` Takashi Iwai
0 siblings, 0 replies; 112+ messages in thread
From: Takashi Iwai @ 2025-07-10 11:20 UTC (permalink / raw)
To: Geraldo Nascimento; +Cc: Takashi Iwai, linux-sound
On Thu, 10 Jul 2025 13:02:57 +0200,
Geraldo Nascimento wrote:
>
> On Thu, Jul 10, 2025 at 12:07:05PM +0200, Takashi Iwai wrote:
> > 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>
> > ---
> > sound/pci/sis7019.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
>
> Hi Takashi,
>
> I think you've missed the "sis7019: " after "ALSA: " on the subject line
> for this one.
Right, I'll correct at applying.
thanks,
Takashi
^ permalink raw reply [flat|nested] 112+ messages in thread
* Re: [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy()
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
` (102 preceding siblings ...)
2025-07-10 10:07 ` [PATCH 103/103] ALSA: core: " Takashi Iwai
@ 2025-07-10 12:37 ` Takashi Sakamoto
103 siblings, 0 replies; 112+ messages in thread
From: Takashi Sakamoto @ 2025-07-10 12:37 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-sound
Hi,
On Thu, Jul 10, 2025 at 12:05:42PM +0200, Takashi Iwai wrote:
> Hi,
>
> this is a collection of small and pretty trivial patches to replace
> the strcpy() calls with strscpy(). Most of changes (except for a few
> last ones) are systematic replacement with strscpy() where the copy is
> done against arrays, so pretty safe.
To the changes for ALSA firewire stack:
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Thanks
Takashi Sakamoto
^ permalink raw reply [flat|nested] 112+ messages in thread
* Re: [PATCH 027/103] ALSA: cs423x: Use safer strscpy() instead of strcpy()
2025-07-10 10:06 ` [PATCH 027/103] ALSA: cs423x: " Takashi Iwai
@ 2025-07-18 9:28 ` Charles Keepax
0 siblings, 0 replies; 112+ messages in thread
From: Charles Keepax @ 2025-07-18 9:28 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-sound
On Thu, Jul 10, 2025 at 12:06:09PM +0200, Takashi Iwai wrote:
> 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>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 112+ messages in thread
* Re: [PATCH 055/103] ALSA: cs4281: Use safer strscpy() instead of strcpy()
2025-07-10 10:06 ` [PATCH 055/103] ALSA: cs4281: " Takashi Iwai
@ 2025-07-18 9:40 ` Charles Keepax
0 siblings, 0 replies; 112+ messages in thread
From: Charles Keepax @ 2025-07-18 9:40 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-sound
On Thu, Jul 10, 2025 at 12:06:37PM +0200, Takashi Iwai wrote:
> 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>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 112+ messages in thread
* Re: [PATCH 056/103] ALSA: cs46xx: Use safer strscpy() instead of strcpy()
2025-07-10 10:06 ` [PATCH 056/103] ALSA: cs46xx: " Takashi Iwai
@ 2025-07-18 9:41 ` Charles Keepax
0 siblings, 0 replies; 112+ messages in thread
From: Charles Keepax @ 2025-07-18 9:41 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-sound
On Thu, Jul 10, 2025 at 12:06:38PM +0200, Takashi Iwai wrote:
> 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>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 112+ messages in thread
* Re: [PATCH 057/103] ALSA: cs5530: Use safer strscpy() instead of strcpy()
2025-07-10 10:06 ` [PATCH 057/103] ALSA: cs5530: " Takashi Iwai
@ 2025-07-18 9:41 ` Charles Keepax
0 siblings, 0 replies; 112+ messages in thread
From: Charles Keepax @ 2025-07-18 9:41 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-sound
On Thu, Jul 10, 2025 at 12:06:39PM +0200, Takashi Iwai wrote:
> 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>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 112+ messages in thread
* Re: [PATCH 058/103] ALSA: cs5535audio: Use safer strscpy() instead of strcpy()
2025-07-10 10:06 ` [PATCH 058/103] ALSA: cs5535audio: " Takashi Iwai
@ 2025-07-18 9:41 ` Charles Keepax
0 siblings, 0 replies; 112+ messages in thread
From: Charles Keepax @ 2025-07-18 9:41 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-sound
On Thu, Jul 10, 2025 at 12:06:40PM +0200, Takashi Iwai wrote:
> 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>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 112+ messages in thread
end of thread, other threads:[~2025-07-18 9:42 UTC | newest]
Thread overview: 112+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 10:05 [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Iwai
2025-07-10 10:05 ` [PATCH 001/103] ALSA: control: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 002/103] ALSA: rawmidi: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 003/103] ALSA: seq: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 004/103] ALSA: mpu401: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 005/103] ALSA: opl3: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 006/103] ALSA: opl4: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 007/103] ALSA: pcsp: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 008/103] ALSA: portman2x4: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 009/103] ALSA: serial-generic: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 010/103] ALSA: serial-u16550: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 011/103] ALSA: virmidi: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 012/103] ALSA: vx: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 013/103] ALSA: firewire: bebob: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 014/103] ALSA: firewire: dice: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 015/103] ALSA: firewire: digi00x: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 016/103] ALSA: firewire: fireface: " Takashi Iwai
2025-07-10 10:05 ` [PATCH 017/103] ALSA: firewire: fireworks: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 018/103] ALSA: firewire: isight: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 019/103] ALSA: firewire: motu: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 020/103] ALSA: firewire: oxfw: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 021/103] ALSA: firewire: tascam: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 022/103] ALSA: ad1816a: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 023/103] ALSA: adlib: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 024/103] ALSA: als100: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 025/103] ALSA: cmi8328: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 026/103] ALSA: cmi8330: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 027/103] ALSA: cs423x: " Takashi Iwai
2025-07-18 9:28 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 028/103] ALSA: es1688: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 029/103] ALSA: es18xx: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 030/103] ALSA: galaxy: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 031/103] ALSA: gus: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 032/103] ALSA: msnd: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 033/103] ALSA: opl3sa2: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 034/103] ALSA: opti9xx: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 035/103] ALSA: sc6000: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 036/103] ALSA: sscape: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 037/103] ALSA: wavefront: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 038/103] ALSA: wss: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 039/103] ALSA: mips: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 040/103] ALSA: parisc: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 041/103] ALSA: ac97: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 042/103] ALSA: ad1889: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 043/103] ALSA: ak4531: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 044/103] ALSA: ali5451: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 045/103] ALSA: als300: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 046/103] ALSA: als4000: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 047/103] ALSA: asihpi: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 048/103] ALSA: atiixp: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 049/103] ALSA: au88x0: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 050/103] ALSA: aw2: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 051/103] ALSA: azt3328: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 052/103] ALSA: bt87x: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 053/103] ALSA: ca0106: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 054/103] ALSA: cmipci: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 055/103] ALSA: cs4281: " Takashi Iwai
2025-07-18 9:40 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 056/103] ALSA: cs46xx: " Takashi Iwai
2025-07-18 9:41 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 057/103] ALSA: cs5530: " Takashi Iwai
2025-07-18 9:41 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 058/103] ALSA: cs5535audio: " Takashi Iwai
2025-07-18 9:41 ` Charles Keepax
2025-07-10 10:06 ` [PATCH 059/103] ALSA: ctxfi: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 060/103] ALSA: echoaudio: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 061/103] ALSA: emu10k1: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 062/103] ALSA: ens1370: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 063/103] ALSA: es1938: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 064/103] ALSA: es1968: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 065/103] ALSA: fm801: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 066/103] ALSA: ice1712: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 067/103] ALSA: ice1724: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 068/103] ALSA: intel8x0: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 069/103] ALSA: korg1212: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 070/103] ALSA: lola: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 071/103] ALSA: lx6464es: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 072/103] ALSA: maestro3: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 073/103] ALSA: mixart: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 074/103] ALSA: nm256: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 075/103] ALSA: oxygen: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 076/103] ALSA: pcxhr: " Takashi Iwai
2025-07-10 10:06 ` [PATCH 077/103] ALSA: riptide: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 078/103] ALSA: rme32: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 079/103] ALSA: rme96: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 080/103] ALSA: hdsp: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 081/103] ALSA: hdspm: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 082/103] ALSA: rme9652: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 083/103] ALSA: " Takashi Iwai
2025-07-10 11:02 ` Geraldo Nascimento
2025-07-10 11:20 ` Takashi Iwai
2025-07-10 10:07 ` [PATCH 084/103] ALSA: sonicvibes: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 085/103] ALSA: trident: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 086/103] ALSA: via82xx: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 087/103] ALSA: ymfpci: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 088/103] ALSA: pdaudiocf: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 089/103] ALSA: vxpocket: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 090/103] ALSA: ppc: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 091/103] ALSA: sh: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 092/103] ALSA: sparc: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 093/103] ALSA: spi: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 094/103] ALSA: synth: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 095/103] ALSA: 6fire: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 096/103] ALSA: line6: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 097/103] ALSA: usx2y: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 098/103] ALSA: ua101: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 099/103] ALSA: usb-audio: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 100/103] ALSA: ac97: Copy string more safely Takashi Iwai
2025-07-10 10:07 ` [PATCH 101/103] ALSA: cmipci: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 102/103] ALSA: usb-audio: " Takashi Iwai
2025-07-10 10:07 ` [PATCH 103/103] ALSA: core: " Takashi Iwai
2025-07-10 12:37 ` [PATCH 000/103] ALSA: Use safer strscpy() instead of strcpy() Takashi Sakamoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).