[PATCH] MIPS: Replace strcpy() with strscpy() in vpe_elfload()

Thorsten Blum posted 1 patch 9 months, 2 weeks ago
arch/mips/kernel/vpe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] MIPS: Replace strcpy() with strscpy() in vpe_elfload()
Posted by Thorsten Blum 9 months, 2 weeks ago
strcpy() is deprecated; use strscpy() instead.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/mips/kernel/vpe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 737d0d4fdcd3..2b67c44adab9 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -22,6 +22,7 @@
 #include <linux/vmalloc.h>
 #include <linux/elf.h>
 #include <linux/seq_file.h>
+#include <linux/string.h>
 #include <linux/syscalls.h>
 #include <linux/moduleloader.h>
 #include <linux/interrupt.h>
@@ -582,7 +583,7 @@ static int vpe_elfload(struct vpe *v)
 	struct module mod; /* so we can re-use the relocations code */
 
 	memset(&mod, 0, sizeof(struct module));
-	strcpy(mod.name, "VPE loader");
+	strscpy(mod.name, "VPE loader");
 
 	hdr = (Elf_Ehdr *) v->pbuffer;
 	len = v->plen;
-- 
2.49.0
Re: [PATCH] MIPS: Replace strcpy() with strscpy() in vpe_elfload()
Posted by Thomas Bogendoerfer 9 months, 2 weeks ago
On Fri, Apr 25, 2025 at 09:46:48AM +0200, Thorsten Blum wrote:
> strcpy() is deprecated; use strscpy() instead.
> 
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  arch/mips/kernel/vpe.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
> index 737d0d4fdcd3..2b67c44adab9 100644
> --- a/arch/mips/kernel/vpe.c
> +++ b/arch/mips/kernel/vpe.c
> @@ -22,6 +22,7 @@
>  #include <linux/vmalloc.h>
>  #include <linux/elf.h>
>  #include <linux/seq_file.h>
> +#include <linux/string.h>
>  #include <linux/syscalls.h>
>  #include <linux/moduleloader.h>
>  #include <linux/interrupt.h>
> @@ -582,7 +583,7 @@ static int vpe_elfload(struct vpe *v)
>  	struct module mod; /* so we can re-use the relocations code */
>  
>  	memset(&mod, 0, sizeof(struct module));
> -	strcpy(mod.name, "VPE loader");
> +	strscpy(mod.name, "VPE loader");
>  
>  	hdr = (Elf_Ehdr *) v->pbuffer;
>  	len = v->plen;
> -- 
> 2.49.0

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]