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

index 4f6b20ed29dd7072ac676c8db67f881e16c5f391..e200e4af799c2fd79829ec3ca5980b52d9a415fe 100644 (file)
@@ -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,