[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220929072905.282639-1-xu.panda668@gmail.com>
Date: Thu, 29 Sep 2022 07:29:06 +0000
From: xu.panda668@...il.com
To: catalin.marinas@....com
Cc: will@...nel.org, broonie@...nel.org, maz@...nel.org,
kristina.martsenko@....com, vladimir.murzin@....com,
mark.rutland@....com, ardb@...nel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
cgel.zte@...il.com, Xu Panda <xu.panda@....com.cn>,
Zeal Robot <zealci@....com.cn>,
Xu Panda <xu.panda668@...il.com>
Subject: [PATCH linux-next] arm64/idreg: use strscpy() is more robust and safer
From: Xu Panda <xu.panda@....com.cn>
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Xu Panda <xu.panda@....com.cn>
Signed-off-by: Xu Panda <xu.panda668@...il.com>
---
arch/arm64/kernel/idreg-override.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c
index 95133765ed29..61bbec7ef62e 100644
--- a/arch/arm64/kernel/idreg-override.c
+++ b/arch/arm64/kernel/idreg-override.c
@@ -246,7 +246,7 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases)
return;
len = min(len, ARRAY_SIZE(buf) - 1);
- strncpy(buf, cmdline, len);
+ strscpy(buf, cmdline, len);
buf[len] = 0;
if (strcmp(buf, "--") == 0)
--
2.15.2
Powered by blists - more mailing lists