]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: firewire: motu: Use safer strscpy() instead of strcpy()
authorTakashi Iwai <tiwai@suse.de>
Thu, 10 Jul 2025 10:06:01 +0000 (12:06 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 11 Jul 2025 07:52:57 +0000 (09:52 +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>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://patch.msgid.link/20250710100727.22653-20-tiwai@suse.de
sound/firewire/motu/motu-hwdep.c
sound/firewire/motu/motu-pcm.c
sound/firewire/motu/motu.c

index 88d1f4b56e4be401d1cb45db2eba4875a1d4b712..1ed60618220d27a45bc81dc730b8d9e6f8be4c63 100644 (file)
@@ -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;
index f3b48495acae28f917fc0cc1d0aa2945fe837add..7b4d476af348f3f23ea7c503eea3ca8078586971 100644 (file)
@@ -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);
index d14ab5dd5bea42f2bf0486e417297e7804ce0f71..fd2a9dddbfa6f3609de248122e1e656eb3619c63 100644 (file)
@@ -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,