diff mbox series

ARM: move from strlcpy with unused retval to strscpy

Message ID 20220818205937.6168-1-wsa+renesas@sang-engineering.com (mailing list archive)
State New
Headers show
Series ARM: move from strlcpy with unused retval to strscpy | expand

Commit Message

Wolfram Sang Aug. 18, 2022, 8:59 p.m. UTC
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 arch/arm/kernel/atags_parse.c     | 4 ++--
 arch/arm/kernel/setup.c           | 2 +-
 arch/arm/kernel/vdso.c            | 2 +-
 arch/arm/mach-s3c/mach-real6410.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

Comments

Krzysztof Kozlowski Aug. 19, 2022, 7:49 a.m. UTC | #1
On 18/08/2022 23:59, Wolfram Sang wrote:
> Follow the advice of the below link and prefer 'strscpy' in this
> subsystem. Conversion is 1:1 because the return value is not used.
> Generated by a coccinelle script.
> 
> Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  arch/arm/kernel/atags_parse.c     | 4 ++--
>  arch/arm/kernel/setup.c           | 2 +-
>  arch/arm/kernel/vdso.c            | 2 +-
>  arch/arm/mach-s3c/mach-real6410.c | 2 +-

If you split s3c, I can take it. Otherwise:

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> # s3c

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c
index 373b61f9a4f0..33f6eb5213a5 100644
--- a/arch/arm/kernel/atags_parse.c
+++ b/arch/arm/kernel/atags_parse.c
@@ -127,7 +127,7 @@  static int __init parse_tag_cmdline(const struct tag *tag)
 #elif defined(CONFIG_CMDLINE_FORCE)
 	pr_warn("Ignoring tag cmdline (using the default kernel command line)\n");
 #else
-	strlcpy(default_command_line, tag->u.cmdline.cmdline,
+	strscpy(default_command_line, tag->u.cmdline.cmdline,
 		COMMAND_LINE_SIZE);
 #endif
 	return 0;
@@ -224,7 +224,7 @@  setup_machine_tags(void *atags_vaddr, unsigned int machine_nr)
 	}
 
 	/* parse_early_param needs a boot_command_line */
-	strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
+	strscpy(boot_command_line, from, COMMAND_LINE_SIZE);
 
 	return mdesc;
 }
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1e8a50a97edf..3f8d7c1eeae4 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1128,7 +1128,7 @@  void __init setup_arch(char **cmdline_p)
 	setup_initial_init_mm(_text, _etext, _edata, _end);
 
 	/* populate cmd_line too for later use, preserving boot_command_line */
-	strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
+	strscpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
 	*cmdline_p = cmd_line;
 
 	early_fixmap_init();
diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c
index 3408269d19c7..f297d66a8a76 100644
--- a/arch/arm/kernel/vdso.c
+++ b/arch/arm/kernel/vdso.c
@@ -135,7 +135,7 @@  static Elf32_Sym * __init find_symbol(struct elfinfo *lib, const char *symname)
 
 		if (lib->dynsym[i].st_name == 0)
 			continue;
-		strlcpy(name, lib->dynstr + lib->dynsym[i].st_name,
+		strscpy(name, lib->dynstr + lib->dynsym[i].st_name,
 			MAX_SYMNAME);
 		c = strchr(name, '@');
 		if (c)
diff --git a/arch/arm/mach-s3c/mach-real6410.c b/arch/arm/mach-s3c/mach-real6410.c
index 8c10ebc38a9c..50427ac7be8e 100644
--- a/arch/arm/mach-s3c/mach-real6410.c
+++ b/arch/arm/mach-s3c/mach-real6410.c
@@ -232,7 +232,7 @@  static char real6410_features_str[12] __initdata = "0";
 static int __init real6410_features_setup(char *str)
 {
 	if (str)
-		strlcpy(real6410_features_str, str,
+		strscpy(real6410_features_str, str,
 			sizeof(real6410_features_str));
 	return 1;
 }