linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: move from strlcpy with unused retval to strscpy
@ 2022-08-18 20:59 Wolfram Sang
  2022-08-19  7:49 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2022-08-18 20:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Wolfram Sang, Russell King, Krzysztof Kozlowski, Alim Akhtar,
	linux-arm-kernel, linux-samsung-soc

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(-)

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;
 }
-- 
2.35.1


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

* Re: [PATCH] ARM: move from strlcpy with unused retval to strscpy
  2022-08-18 20:59 [PATCH] ARM: move from strlcpy with unused retval to strscpy Wolfram Sang
@ 2022-08-19  7:49 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-19  7:49 UTC (permalink / raw)
  To: Wolfram Sang, linux-kernel
  Cc: Russell King, Alim Akhtar, linux-arm-kernel, linux-samsung-soc

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

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

end of thread, other threads:[~2022-08-19  7:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-18 20:59 [PATCH] ARM: move from strlcpy with unused retval to strscpy Wolfram Sang
2022-08-19  7:49 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).