]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: vx: Use safer strscpy() instead of strcpy()
authorTakashi Iwai <tiwai@suse.de>
Thu, 10 Jul 2025 10:05:54 +0000 (12:05 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 11 Jul 2025 07:51:09 +0000 (09:51 +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-13-tiwai@suse.de
sound/drivers/vx/vx_core.c
sound/drivers/vx/vx_mixer.c
sound/drivers/vx/vx_pcm.c

index e2def8719ed2cd9b5aace2e3938d194102897276..7f25fa7c04043cb1bc8b145008c4d10f6a755064 100644 (file)
@@ -806,7 +806,7 @@ struct vx_core *snd_vx_create(struct snd_card *card,
 
        chip->card = card;
        card->private_data = chip;
-       strcpy(card->driver, hw->name);
+       strscpy(card->driver, hw->name);
        sprintf(card->shortname, "Digigram %s", hw->name);
 
        vx_proc_init(chip);
index 53d78eb13c53bcbe9b79c93f20b955bd6c1a3c95..0a51ecdc084a98621bf40b46b97f3737acf25caa 100644 (file)
@@ -903,7 +903,7 @@ int snd_vx_mixer_new(struct vx_core *chip)
        struct snd_card *card = chip->card;
        char name[32];
 
-       strcpy(card->mixername, card->driver);
+       strscpy(card->mixername, card->driver);
 
        /* output level controls */
        for (i = 0; i < chip->hw->num_outs; i++) {
index cbc77ca1ebdd54ff04d0ee04ae21c1bc4eae0081..defc489494af752a8f69a4d2a6bca1d2bf697e52 100644 (file)
@@ -1226,7 +1226,7 @@ int snd_vx_pcm_new(struct vx_core *chip)
                pcm->private_free = snd_vx_pcm_free;
                pcm->info_flags = 0;
                pcm->nonatomic = true;
-               strcpy(pcm->name, chip->card->shortname);
+               strscpy(pcm->name, chip->card->shortname);
                chip->pcm[i] = pcm;
        }