From: Siddarth Gundu <siddarthsgml@gmail.com>
To: perex@perex.cz, tiwai@suse.com
Cc: u.kleine-koenig@baylibre.com, zhujun2@cmss.chinamobile.com,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Siddarth Gundu <siddarthsgml@gmail.com>
Subject: [PATCH] ALSA: dbri: replace strcpy() with strscpy()
Date: Tue, 20 May 2025 01:18:33 +0530 [thread overview]
Message-ID: <20250519194833.106463-1-siddarthsgml@gmail.com> (raw)
strcpy() is deprecated; use strscpy() instead.
Both the destination and source buffer are of fixed length
so strscpy with 2-arguments is used.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Siddarth Gundu <siddarthsgml@gmail.com>
---
- test-compiled and no functional changes intended
sound/sparc/dbri.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 69f1c9e37f4b..93cbe158009f 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -60,6 +60,7 @@
#include <linux/io.h>
#include <linux/dma-mapping.h>
#include <linux/gfp.h>
+#include <linux/string.h>
#include <sound/core.h>
#include <sound/pcm.h>
@@ -2239,7 +2240,7 @@ static int snd_dbri_pcm(struct snd_card *card)
pcm->private_data = card->private_data;
pcm->info_flags = 0;
- strcpy(pcm->name, card->shortname);
+ strscpy(pcm->name, card->shortname);
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
NULL, 64 * 1024, 64 * 1024);
@@ -2446,7 +2447,7 @@ static int snd_dbri_mixer(struct snd_card *card)
return -EINVAL;
dbri = card->private_data;
- strcpy(card->mixername, card->shortname);
+ strscpy(card->mixername, card->shortname);
for (idx = 0; idx < ARRAY_SIZE(dbri_controls); idx++) {
err = snd_ctl_add(card,
@@ -2613,8 +2614,8 @@ static int dbri_probe(struct platform_device *op)
if (err < 0)
return err;
- strcpy(card->driver, "DBRI");
- strcpy(card->shortname, "Sun DBRI");
+ strscpy(card->driver, "DBRI");
+ strscpy(card->shortname, "Sun DBRI");
rp = &op->resource[0];
sprintf(card->longname, "%s at 0x%02lx:0x%016llx, irq %d",
card->shortname,
--
2.48.1
next reply other threads:[~2025-05-19 19:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-19 19:48 Siddarth Gundu [this message]
2025-05-19 20:38 ` [PATCH] ALSA: dbri: replace strcpy() with strscpy() Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250519194833.106463-1-siddarthsgml@gmail.com \
--to=siddarthsgml@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=zhujun2@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox