linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] arm64/idreg: use strscpy() is more robust and safer
@ 2022-09-29  7:29 xu.panda668
  2022-10-04 11:48 ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: xu.panda668 @ 2022-09-29  7:29 UTC (permalink / raw)
  To: catalin.marinas
  Cc: will, broonie, maz, kristina.martsenko, vladimir.murzin,
	mark.rutland, ardb, linux-arm-kernel, linux-kernel, cgel.zte,
	Xu Panda, Zeal Robot, Xu Panda

From: Xu Panda <xu.panda@zte.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@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda668@gmail.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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH linux-next] arm64/idreg: use strscpy() is more robust and safer
@ 2022-09-29  7:10 cgel.zte
  0 siblings, 0 replies; 5+ messages in thread
From: cgel.zte @ 2022-09-29  7:10 UTC (permalink / raw)
  To: catalin.marinas
  Cc: will, broonie, maz, kristina.martsenko, vladimir.murzin,
	mark.rutland, ardb, linux-arm-kernel, linux-kernel, cgel.zte,
	Xu Panda, Zeal Robot, Xu Panda

From: Xu Panda <xu.panda@zte.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@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda668@gmail.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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH linux-next] arm64/idreg: use strscpy() is more robust and safer
@ 2022-09-29  6:51 cgel.zte
  0 siblings, 0 replies; 5+ messages in thread
From: cgel.zte @ 2022-09-29  6:51 UTC (permalink / raw)
  To: catalin.marinas
  Cc: will, broonie, maz, kristina.martsenko, vladimir.murzin,
	mark.rutland, ardb, linux-arm-kernel, linux-kernel, cgel.zte,
	Xu Panda, Zeal Robot, Xu Panda

From: Xu Panda <xu.panda@zte.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@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda668@gmail.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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29  7:29 [PATCH linux-next] arm64/idreg: use strscpy() is more robust and safer xu.panda668
2022-10-04 11:48 ` Will Deacon
2022-10-05 13:57   ` David Laight
  -- strict thread matches above, loose matches on Subject: below --
2022-09-29  7:10 cgel.zte
2022-09-29  6:51 cgel.zte

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