The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] sh: dma: use strscpy in register_dmac
@ 2026-05-10 16:10 Thorsten Blum
  2026-05-11 11:29 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-05-10 16:10 UTC (permalink / raw)
  To: Rich Felker, John Paul Adrian Glaubitz
  Cc: linux-sh, linux-kernel, Thorsten Blum

Replace memcpy() and the hard-coded string length with strscpy() to
improve register_dmac().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/sh/drivers/dma/dma-api.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index 87e5a8928873..31b614358270 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -16,6 +16,7 @@
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <asm/dma.h>
 
 DEFINE_SPINLOCK(dma_spin_lock);
@@ -232,7 +233,7 @@ int register_dmac(struct dma_info *info)
 		chan->chan  = info->first_channel_nr + i;
 		chan->vchan = info->first_channel_nr + i + total_channels;
 
-		memcpy(chan->dev_id, "Unused", 7);
+		strscpy(chan->dev_id, "Unused");
 
 		if (info->flags & DMAC_CHANNELS_TEI_CAPABLE)
 			chan->flags |= DMA_TEI_CAPABLE;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sh: dma: use strscpy in register_dmac
  2026-05-10 16:10 [PATCH] sh: dma: use strscpy in register_dmac Thorsten Blum
@ 2026-05-11 11:29 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2026-05-11 11:29 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Rich Felker, John Paul Adrian Glaubitz, linux-sh, linux-kernel

On Sun, 10 May 2026 at 18:11, Thorsten Blum <thorsten.blum@linux.dev> wrote:
> Replace memcpy() and the hard-coded string length with strscpy() to
> improve register_dmac().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-11 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-10 16:10 [PATCH] sh: dma: use strscpy in register_dmac Thorsten Blum
2026-05-11 11:29 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox