]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: line6: Use safer strscpy() instead of strcpy()
authorTakashi Iwai <tiwai@suse.de>
Thu, 10 Jul 2025 10:07:18 +0000 (12:07 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 11 Jul 2025 07:53:35 +0000 (09:53 +0200)
Use a safer function strscpy() instead of strcpy() for copying to
arrays.

Only idiomatic code replacement, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250710100727.22653-97-tiwai@suse.de
sound/usb/line6/driver.c
sound/usb/line6/midi.c
sound/usb/line6/pcm.c
sound/usb/line6/toneport.c

index e9eb5c74d6c7ab71fbc930f57c0daeebd5d88de3..f2f9261489a214883546f5904790a706f1faf445 100644 (file)
@@ -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;
index 9b51760862809e50a61ac90a199487fe474c00c8..1d77794b4490bdc750b2d54a375b9a719ce319c0 100644 (file)
@@ -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 |
index d4dbbc432505dbfa01df23e43b2ae2b2d55d5588..c1e2a8ab66fac58492a118d9be9b8805f16681b2 100644 (file)
@@ -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,
index c073b38cd6738176fc6a276d05ed553526573341..68cda7bf330c7080b50554779b8a6d4a03264772 100644 (file)
@@ -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;