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

index a0fe9961855497202ff2d3455547d1be6a1531f0..3be214d8a9228c7914537c8355a897c59fbe09c8 100644 (file)
@@ -177,7 +177,7 @@ int snd_oxfw_create_hwdep(struct snd_oxfw *oxfw)
        err = snd_hwdep_new(oxfw->card, oxfw->card->driver, 0, &hwdep);
        if (err < 0)
                goto end;
-       strcpy(hwdep->name, oxfw->card->driver);
+       strscpy(hwdep->name, oxfw->card->driver);
        hwdep->iface = SNDRV_HWDEP_IFACE_FW_OXFW;
        hwdep->ops = hwdep_ops;
        hwdep->private_data = oxfw;
index 8ca9dde54ec6f4dc2c2cf8a94084735325b1cea1..e13dc817fc280882b60b2dd46c50056b567bcb0d 100644 (file)
@@ -441,7 +441,7 @@ int snd_oxfw_create_pcm(struct snd_oxfw *oxfw)
 
        pcm->private_data = oxfw;
        pcm->nonatomic = true;
-       strcpy(pcm->name, oxfw->card->shortname);
+       strscpy(pcm->name, oxfw->card->shortname);
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_ops);
        if (cap > 0)
                snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_ops);
index 98ae0e8cba8790eead0a6fb0c3a102bb590cd13d..7a985f3cb8f619b579daa8c4aa0b2f0908d92523 100644 (file)
@@ -105,9 +105,9 @@ static int name_card(struct snd_oxfw *oxfw, const struct ieee1394_device_id *ent
                m = model;
        }
 
-       strcpy(oxfw->card->driver, d);
-       strcpy(oxfw->card->mixername, m);
-       strcpy(oxfw->card->shortname, m);
+       strscpy(oxfw->card->driver, d);
+       strscpy(oxfw->card->mixername, m);
+       strscpy(oxfw->card->shortname, m);
 
        scnprintf(oxfw->card->longname, sizeof(oxfw->card->longname),
                  "%s %s (OXFW%x %04x), GUID %08x%08x at %s, S%d",