* [PATCH] ALSA: echoaudio: Replace deprecated strcpy() with strscpy()
@ 2025-07-09 12:46 Thorsten Blum
2025-07-09 14:05 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2025-07-09 12:46 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Andy Shevchenko, Philipp Stanner,
Andres Urian Florez
Cc: Thorsten Blum, Takashi Iwai, linux-sound, linux-kernel
strcpy() is deprecated; use strscpy() instead.
No functional changes intended.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
sound/pci/echoaudio/echoaudio.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 80d8ce75fdbb..2b33ef588ac3 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -6,6 +6,7 @@
*/
#include <linux/module.h>
+#include <linux/string.h>
MODULE_AUTHOR("Giuliano Pochini <pochini@shiny.it>");
MODULE_LICENSE("GPL v2");
@@ -916,7 +917,7 @@ static int snd_echo_new_pcm(struct echoaudio *chip)
return err;
pcm->private_data = chip;
chip->analog_pcm = pcm;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &analog_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &analog_capture_ops);
snd_echo_preallocate_pages(pcm, &chip->pci->dev);
@@ -929,7 +930,7 @@ static int snd_echo_new_pcm(struct echoaudio *chip)
return err;
pcm->private_data = chip;
chip->digital_pcm = pcm;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &digital_capture_ops);
snd_echo_preallocate_pages(pcm, &chip->pci->dev);
#endif /* ECHOCARD_HAS_DIGITAL_IO */
@@ -949,7 +950,7 @@ static int snd_echo_new_pcm(struct echoaudio *chip)
return err;
pcm->private_data = chip;
chip->analog_pcm = pcm;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &analog_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &analog_capture_ops);
snd_echo_preallocate_pages(pcm, &chip->pci->dev);
@@ -963,7 +964,7 @@ static int snd_echo_new_pcm(struct echoaudio *chip)
return err;
pcm->private_data = chip;
chip->digital_pcm = pcm;
- strcpy(pcm->name, chip->card->shortname);
+ strscpy(pcm->name, chip->card->shortname);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &digital_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &digital_capture_ops);
snd_echo_preallocate_pages(pcm, &chip->pci->dev);
@@ -1985,8 +1986,8 @@ static int __snd_echo_probe(struct pci_dev *pci,
if (err < 0)
return err;
- strcpy(card->driver, "Echo_" ECHOCARD_NAME);
- strcpy(card->shortname, chip->card_name);
+ strscpy(card->driver, "Echo_" ECHOCARD_NAME);
+ strscpy(card->shortname, chip->card_name);
dsp = "56301";
if (pci_id->device == 0x3410)
--
2.50.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] ALSA: echoaudio: Replace deprecated strcpy() with strscpy()
2025-07-09 12:46 [PATCH] ALSA: echoaudio: Replace deprecated strcpy() with strscpy() Thorsten Blum
@ 2025-07-09 14:05 ` Takashi Iwai
2025-07-09 20:55 ` Thorsten Blum
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2025-07-09 14:05 UTC (permalink / raw)
To: Thorsten Blum
Cc: Jaroslav Kysela, Takashi Iwai, Andy Shevchenko, Philipp Stanner,
Andres Urian Florez, Takashi Iwai, linux-sound, linux-kernel
On Wed, 09 Jul 2025 14:46:52 +0200,
Thorsten Blum wrote:
>
> strcpy() is deprecated; use strscpy() instead.
>
> No functional changes intended.
>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Thanks, applied now.
And now I'm going to convert all the rest of such trivial stuff
(strcpy() with card->driver, shortname, mixername, longname, as well
as pcm->name, and else) in sound/* for 6.17.
Takashi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: echoaudio: Replace deprecated strcpy() with strscpy()
2025-07-09 14:05 ` Takashi Iwai
@ 2025-07-09 20:55 ` Thorsten Blum
2025-07-10 8:34 ` Andy Shevchenko
0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2025-07-09 20:55 UTC (permalink / raw)
To: Takashi Iwai
Cc: Jaroslav Kysela, Takashi Iwai, Andy Shevchenko, Philipp Stanner,
Andres Urian Florez, linux-sound, linux-kernel
On 9. Jul 2025, at 16:05, Takashi Iwai wrote:
> Thanks, applied now.
>
> And now I'm going to convert all the rest of such trivial stuff
> (strcpy() with card->driver, shortname, mixername, longname, as well
> as pcm->name, and else) in sound/* for 6.17.
Yes, please :) I thought about submitting a patch series for all of
sound/*, but didn't find the time yet.
Thanks,
Thorsten
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: echoaudio: Replace deprecated strcpy() with strscpy()
2025-07-09 20:55 ` Thorsten Blum
@ 2025-07-10 8:34 ` Andy Shevchenko
2025-07-10 8:41 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2025-07-10 8:34 UTC (permalink / raw)
To: Thorsten Blum
Cc: Takashi Iwai, Jaroslav Kysela, Takashi Iwai, Philipp Stanner,
Andres Urian Florez, linux-sound, linux-kernel
On Wed, Jul 09, 2025 at 10:55:02PM +0200, Thorsten Blum wrote:
> On 9. Jul 2025, at 16:05, Takashi Iwai wrote:
> > Thanks, applied now.
> > And now I'm going to convert all the rest of such trivial stuff
> > (strcpy() with card->driver, shortname, mixername, longname, as well
> > as pcm->name, and else) in sound/* for 6.17.
>
> Yes, please :) I thought about submitting a patch series for all of
> sound/*, but didn't find the time yet.
Note that strscpy() supports 3rd argument optionally, it means it's better
to use 2-arg variant when the destination is supposed to be an array of
characters.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: echoaudio: Replace deprecated strcpy() with strscpy()
2025-07-10 8:34 ` Andy Shevchenko
@ 2025-07-10 8:41 ` Takashi Iwai
0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2025-07-10 8:41 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Thorsten Blum, Takashi Iwai, Jaroslav Kysela, Takashi Iwai,
Philipp Stanner, Andres Urian Florez, linux-sound, linux-kernel
On Thu, 10 Jul 2025 10:34:57 +0200,
Andy Shevchenko wrote:
>
> On Wed, Jul 09, 2025 at 10:55:02PM +0200, Thorsten Blum wrote:
> > On 9. Jul 2025, at 16:05, Takashi Iwai wrote:
> > > Thanks, applied now.
>
> > > And now I'm going to convert all the rest of such trivial stuff
> > > (strcpy() with card->driver, shortname, mixername, longname, as well
> > > as pcm->name, and else) in sound/* for 6.17.
> >
> > Yes, please :) I thought about submitting a patch series for all of
> > sound/*, but didn't find the time yet.
>
> Note that strscpy() supports 3rd argument optionally, it means it's better
> to use 2-arg variant when the destination is supposed to be an array of
> characters.
Yes, most of Thomas' patches are using 2 arg variant, just replacing
strcpy() with strscpy().
thanks,
Takashi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-07-10 8:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 12:46 [PATCH] ALSA: echoaudio: Replace deprecated strcpy() with strscpy() Thorsten Blum
2025-07-09 14:05 ` Takashi Iwai
2025-07-09 20:55 ` Thorsten Blum
2025-07-10 8:34 ` Andy Shevchenko
2025-07-10 8:41 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.