sh: dma: use strscpy in register_dmac
PATCH 1/1 sh: dma: use strscpy in register_dmac
Replace memcpy() and the hard-coded string length with strscpy() to improve register_dmac().
Signed-off-by Thorsten Blum <[email protected]>
--- arch/sh/drivers/dma/dma-api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/sh/drivers/dma/dma-api.c +2 -1
@@ -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 ;
Quoted 4 lines · Thorsten Blum
Replace
memcpy()and the hard-coded string length withstrscpy()to improveregister_dmac().Signed-off-by Thorsten Blum <[email protected]>
Reviewed-by Geert Uytterhoeven <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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