]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: usx2y: Use safer strscpy() instead of strcpy()
authorTakashi Iwai <tiwai@suse.de>
Thu, 10 Jul 2025 10:07:19 +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-98-tiwai@suse.de
sound/usb/usx2y/us122l.c
sound/usb/usx2y/usX2Yhwdep.c
sound/usb/usx2y/usbusx2y.c

index 6bcf8b859ebb200a0834cf4f3c67ba3acd75811e..2ace3ba46091fdd17848b871cb4273658c8b5e8a 100644 (file)
@@ -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,
index 9fd6a86cc08e065c468d943ce7eecb85a6d0cacf..4d792518482618fbd2d5fe4adf750dbab3fe945c 100644 (file)
@@ -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;
index 5756ff3528a2d396157da27a6b12675e8e857394..f34e78910200aabe7f69dbc34b9a231935d92b3a 100644 (file)
@@ -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,