Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: sh: Use safer strscpy() instead of strcpy()

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-92-tiwai@suse.de

+7 -7
+4 -4
sound/sh/aica.c
··· 424 424 if (unlikely(err < 0)) 425 425 return err; 426 426 pcm->private_data = dreamcastcard; 427 - strcpy(pcm->name, "AICA PCM"); 427 + strscpy(pcm->name, "AICA PCM"); 428 428 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 429 429 &snd_aicapcm_playback_ops); 430 430 /* Allocate the DMA buffers */ ··· 568 568 kfree(dreamcastcard); 569 569 return err; 570 570 } 571 - strcpy(dreamcastcard->card->driver, "snd_aica"); 572 - strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER); 573 - strcpy(dreamcastcard->card->longname, 571 + strscpy(dreamcastcard->card->driver, "snd_aica"); 572 + strscpy(dreamcastcard->card->shortname, SND_AICA_DRIVER); 573 + strscpy(dreamcastcard->card->longname, 574 574 "Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast"); 575 575 /* Prepare to use the queue */ 576 576 INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma);
+3 -3
sound/sh/sh_dac_audio.c
··· 224 224 return err; 225 225 226 226 pcm->private_data = chip; 227 - strcpy(pcm->name, "SH_DAC PCM"); 227 + strscpy(pcm->name, "SH_DAC PCM"); 228 228 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops); 229 229 230 230 /* buffer size=48K */ ··· 358 358 if (err < 0) 359 359 goto probe_error; 360 360 361 - strcpy(card->driver, "snd_sh_dac"); 362 - strcpy(card->shortname, "SuperH DAC audio driver"); 361 + strscpy(card->driver, "snd_sh_dac"); 362 + strscpy(card->shortname, "SuperH DAC audio driver"); 363 363 dev_info(&devptr->dev, "%s %s\n", card->longname, card->shortname); 364 364 365 365 err = snd_card_register(card);