[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <730f0fef.a33.180fa69880f.Coremail.chenxuebing@jari.cn>
Date: Wed, 25 May 2022 16:51:01 +0800 (GMT+08:00)
From: "XueBing Chen" <chenxuebing@...i.cn>
To: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org
Cc: hpa@...or.com, rppt@...nel.org, akpm@...ux-foundation.org,
daniel.kiper@...cle.com, konrad@...nel.org,
ross.philipson@...cle.com, jszhang@...nel.org,
andriy.shevchenko@...ux.intel.com, jgross@...e.com,
mlombard@...hat.com, linux-kernel@...r.kernel.org
Subject: [PATCH] x86/setup: use strscpy to replace strlcpy
The strlcpy should not be used because it doesn't limit the source
length. Preferred is strscpy.
Signed-off-by: XueBing Chen <chenxuebing@...i.cn>
---
arch/x86/kernel/setup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c95b9ac5a457..f95eaba2c8ad 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -879,18 +879,18 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_CMDLINE_BOOL
#ifdef CONFIG_CMDLINE_OVERRIDE
- strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
+ strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
#else
if (builtin_cmdline[0]) {
/* append boot loader cmdline to builtin */
strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
- strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
+ strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
}
#endif
#endif
- strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
+ strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
/*
--
2.36.1
Powered by blists - more mailing lists