public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] m68knommu: Replace deprecated strcpy with strscpy in init_ucsimm
@ 2026-01-18 17:33 Thorsten Blum
  2026-01-18 23:23 ` Greg Ungerer
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-01-18 17:33 UTC (permalink / raw)
  To: Greg Ungerer, Geert Uytterhoeven; +Cc: Thorsten Blum, linux-m68k, linux-kernel

strcpy() has been deprecated [1] because it performs no bounds checking
on the destination buffer, which can lead to buffer overflows. Replace
it with the safer strscpy().

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Compile-tested only.
---
 arch/m68k/68000/ucsimm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/68000/ucsimm.c b/arch/m68k/68000/ucsimm.c
index c54fde75eae8..6b84e826040f 100644
--- a/arch/m68k/68000/ucsimm.c
+++ b/arch/m68k/68000/ucsimm.c
@@ -9,6 +9,7 @@
  * for more details.
  */
 #include <linux/init.h>
+#include <linux/string.h>
 #include <asm/bootstd.h>
 #include <asm/machdep.h>
 #include <asm/MC68VZ328.h>
@@ -31,7 +32,7 @@ void __init init_ucsimm(char *command, int size)
 	pr_info("uCsimm/uCdimm hwaddr %pM\n", p);
 	p = getbenv("APPEND");
 	if (p)
-		strcpy(p, command);
+		strscpy(p, command, size);
 	else
 		command[0] = 0;
 }
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


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

* Re: [PATCH] m68knommu: Replace deprecated strcpy with strscpy in init_ucsimm
  2026-01-18 17:33 [PATCH] m68knommu: Replace deprecated strcpy with strscpy in init_ucsimm Thorsten Blum
@ 2026-01-18 23:23 ` Greg Ungerer
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Ungerer @ 2026-01-18 23:23 UTC (permalink / raw)
  To: Thorsten Blum, Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel

Hi Thorsten,

On 19/1/26 03:33, Thorsten Blum wrote:
> strcpy() has been deprecated [1] because it performs no bounds checking
> on the destination buffer, which can lead to buffer overflows. Replace
> it with the safer strscpy().
> 
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Thanks, applied to m68knommu git tree, for-next branch.

Regards
Greg



> ---
> Compile-tested only.
> ---
>   arch/m68k/68000/ucsimm.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/m68k/68000/ucsimm.c b/arch/m68k/68000/ucsimm.c
> index c54fde75eae8..6b84e826040f 100644
> --- a/arch/m68k/68000/ucsimm.c
> +++ b/arch/m68k/68000/ucsimm.c
> @@ -9,6 +9,7 @@
>    * for more details.
>    */
>   #include <linux/init.h>
> +#include <linux/string.h>
>   #include <asm/bootstd.h>
>   #include <asm/machdep.h>
>   #include <asm/MC68VZ328.h>
> @@ -31,7 +32,7 @@ void __init init_ucsimm(char *command, int size)
>   	pr_info("uCsimm/uCdimm hwaddr %pM\n", p);
>   	p = getbenv("APPEND");
>   	if (p)
> -		strcpy(p, command);
> +		strscpy(p, command, size);
>   	else
>   		command[0] = 0;
>   }


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

end of thread, other threads:[~2026-01-18 23:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-18 17:33 [PATCH] m68knommu: Replace deprecated strcpy with strscpy in init_ucsimm Thorsten Blum
2026-01-18 23:23 ` Greg Ungerer

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