All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mips: setup: use strscpy to replace strlcpy
@ 2022-05-22  7:46 陈学兵
  2022-05-23  9:39 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: 陈学兵 @ 2022-05-22  7:46 UTC (permalink / raw)
  To: tsbogend
  Cc: catalin.marinas, rdunlap, rppt, rafael.j.wysocki, linux-mips,
	linux-kernel


The strlcpy should not be used because it doesn't limit the source
length. Preferred is strscpy.

Signed-off-by: XueBing Chen <chenxuebing@jari.cn>
---
 arch/mips/kernel/setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index ef73ba1e0ec1..ad3aea81d0e2 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -554,7 +554,7 @@ static void __init bootcmdline_init(void)
 	 * unmodified.
 	 */
 	if (IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) {
-		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
+		strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 		return;
 	}
 
@@ -566,7 +566,7 @@ static void __init bootcmdline_init(void)
 	 * boot_command_line to undo anything early_init_dt_scan_chosen() did.
 	 */
 	if (IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND))
-		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
+		strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 	else
 		boot_command_line[0] = 0;
 
@@ -628,7 +628,7 @@ static void __init arch_mem_init(char **cmdline_p)
 	memblock_set_bottom_up(true);
 
 	bootcmdline_init();
-	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
+	strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
 	*cmdline_p = command_line;
 
 	parse_early_param();
-- 
2.36.1



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

* Re: [PATCH] mips: setup: use strscpy to replace strlcpy
  2022-05-22  7:46 [PATCH] mips: setup: use strscpy to replace strlcpy 陈学兵
@ 2022-05-23  9:39 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2022-05-23  9:39 UTC (permalink / raw)
  To: 陈学兵
  Cc: catalin.marinas, rdunlap, rppt, rafael.j.wysocki, linux-mips,
	linux-kernel

On Sun, May 22, 2022 at 03:46:18PM +0800, 陈学兵 wrote:
> 
> The strlcpy should not be used because it doesn't limit the source
> length. Preferred is strscpy.
> 
> Signed-off-by: XueBing Chen <chenxuebing@jari.cn>
> ---
>  arch/mips/kernel/setup.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

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 ]

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

end of thread, other threads:[~2022-05-23 10:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22  7:46 [PATCH] mips: setup: use strscpy to replace strlcpy 陈学兵
2022-05-23  9:39 ` Thomas Bogendoerfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.