summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2025-07-10 12:07:21 +0200
committerTakashi Iwai <tiwai@suse.de>2025-07-11 09:53:35 +0200
commita9b25e8a437586fb1e1749caae96e305dc9e4906 (patch)
tree8231a9fe50effb8285ee47e8ebf14c5285784e62
parent414e4f01f663d9d46cee98d1c8d2ef33f10ec26e (diff)
ALSA: usb-audio: Use safer strscpy() instead of strcpy()
Use a safer function strscpy() instead of strcpy() for copying to arrays. Only idiomatic code replacement, and no functional changes. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250710100727.22653-100-tiwai@suse.de
-rw-r--r--sound/usb/card.c2
-rw-r--r--sound/usb/midi.c2
-rw-r--r--sound/usb/mixer.c2
-rw-r--r--sound/usb/stream.c2
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);