* [PATCH RESEND] alpha: Replace strcpy() with strscpy() in setup_arch()
@ 2025-05-21 12:20 Thorsten Blum
0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2025-05-21 12:20 UTC (permalink / raw)
To: Richard Henderson, Matt Turner
Cc: linux-hardening, Thorsten Blum, linux-alpha, linux-kernel
strcpy() is deprecated; use strscpy() instead.
Since the destination buffer 'command_line' has a fixed length,
strscpy() automatically determines its size using sizeof() when the size
argument is omitted. This makes the explicit size argument for the
existing strscpy() call unnecessary - remove it.
No functional changes intended.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/alpha/kernel/setup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index bebdffafaee8..8b51e6ca83d6 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -468,8 +468,8 @@ setup_arch(char **cmdline_p)
/*
* Locate the command line.
*/
- strscpy(command_line, COMMAND_LINE, sizeof(command_line));
- strcpy(boot_command_line, command_line);
+ strscpy(command_line, COMMAND_LINE);
+ strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
/*
@@ -511,7 +511,7 @@ setup_arch(char **cmdline_p)
}
/* Replace the command line, now that we've killed it with strsep. */
- strcpy(command_line, boot_command_line);
+ strscpy(command_line, boot_command_line);
/* If we want SRM console printk echoing early, do it now. */
if (alpha_using_srm && srmcons_output) {
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH RESEND] alpha: Replace strcpy() with strscpy() in setup_arch()
@ 2025-06-19 14:58 Thorsten Blum
0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2025-06-19 14:58 UTC (permalink / raw)
To: Richard Henderson, Matt Turner; +Cc: Thorsten Blum, linux-alpha, linux-kernel
strcpy() is deprecated; use strscpy() instead.
Since the destination buffer 'command_line' has a fixed length,
strscpy() automatically determines its size using sizeof() when the size
argument is omitted. This makes the explicit size argument for the
existing strscpy() call unnecessary - remove it.
No functional changes intended.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/alpha/kernel/setup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index bebdffafaee8..8b51e6ca83d6 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -468,8 +468,8 @@ setup_arch(char **cmdline_p)
/*
* Locate the command line.
*/
- strscpy(command_line, COMMAND_LINE, sizeof(command_line));
- strcpy(boot_command_line, command_line);
+ strscpy(command_line, COMMAND_LINE);
+ strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
/*
@@ -511,7 +511,7 @@ setup_arch(char **cmdline_p)
}
/* Replace the command line, now that we've killed it with strsep. */
- strcpy(command_line, boot_command_line);
+ strscpy(command_line, boot_command_line);
/* If we want SRM console printk echoing early, do it now. */
if (alpha_using_srm && srmcons_output) {
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH RESEND] alpha: Replace strcpy() with strscpy() in setup_arch()
@ 2025-07-16 21:11 Thorsten Blum
0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2025-07-16 21:11 UTC (permalink / raw)
To: Richard Henderson, Matt Turner
Cc: linux-hardening, Thorsten Blum, linux-alpha, linux-kernel
strcpy() is deprecated; use strscpy() instead.
Since the destination buffer 'command_line' has a fixed length,
strscpy() automatically determines its size using sizeof() when the size
argument is omitted. This makes the explicit size argument for the
existing strscpy() call unnecessary - remove it.
No functional changes intended.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/alpha/kernel/setup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index bebdffafaee8..8b51e6ca83d6 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -468,8 +468,8 @@ setup_arch(char **cmdline_p)
/*
* Locate the command line.
*/
- strscpy(command_line, COMMAND_LINE, sizeof(command_line));
- strcpy(boot_command_line, command_line);
+ strscpy(command_line, COMMAND_LINE);
+ strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
/*
@@ -511,7 +511,7 @@ setup_arch(char **cmdline_p)
}
/* Replace the command line, now that we've killed it with strsep. */
- strcpy(command_line, boot_command_line);
+ strscpy(command_line, boot_command_line);
/* If we want SRM console printk echoing early, do it now. */
if (alpha_using_srm && srmcons_output) {
--
2.50.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH RESEND] alpha: Replace strcpy() with strscpy() in setup_arch()
@ 2025-08-17 23:17 Thorsten Blum
2025-08-30 19:11 ` Magnus Lindholm
0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2025-08-17 23:17 UTC (permalink / raw)
To: Richard Henderson, Matt Turner
Cc: linux-hardening, Thorsten Blum, linux-alpha, linux-kernel
strcpy() is deprecated; use strscpy() instead.
Since the destination buffer 'command_line' has a fixed length,
strscpy() automatically determines its size using sizeof() when the size
argument is omitted. This makes the explicit size argument for the
existing strscpy() call unnecessary - remove it.
No functional changes intended.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/alpha/kernel/setup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index bebdffafaee8..8b51e6ca83d6 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -468,8 +468,8 @@ setup_arch(char **cmdline_p)
/*
* Locate the command line.
*/
- strscpy(command_line, COMMAND_LINE, sizeof(command_line));
- strcpy(boot_command_line, command_line);
+ strscpy(command_line, COMMAND_LINE);
+ strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
/*
@@ -511,7 +511,7 @@ setup_arch(char **cmdline_p)
}
/* Replace the command line, now that we've killed it with strsep. */
- strcpy(command_line, boot_command_line);
+ strscpy(command_line, boot_command_line);
/* If we want SRM console printk echoing early, do it now. */
if (alpha_using_srm && srmcons_output) {
--
2.50.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] alpha: Replace strcpy() with strscpy() in setup_arch()
2025-08-17 23:17 Thorsten Blum
@ 2025-08-30 19:11 ` Magnus Lindholm
0 siblings, 0 replies; 5+ messages in thread
From: Magnus Lindholm @ 2025-08-30 19:11 UTC (permalink / raw)
To: Thorsten Blum
Cc: Richard Henderson, Matt Turner, linux-hardening, linux-alpha,
linux-kernel
Hi,
It can be a bit controversial to replace the platform specific string
manipulation functions with a generic interface. On Alpha, there is nothing
(at least to my knowledge) that indicates that strcpy is broken or used in
an unsafe way and hence this patch doesn't really fix anything.
In my opinion, I think this should be a NAK.
Linus wrote some relevant stuff on this topic
Link:
https://github.com/torvalds/linux/commit/30c44659f4a3e7e1f9f47e895591b4b40bf62671
like for example:
"Use this in places where it makes sense, but don't do trivial patches
to fix things that aren't actually known to be broken."
Regards
Magnus Lindholm
On Mon, Aug 18, 2025 at 1:23 AM Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> strcpy() is deprecated; use strscpy() instead.
>
> Since the destination buffer 'command_line' has a fixed length,
> strscpy() automatically determines its size using sizeof() when the size
> argument is omitted. This makes the explicit size argument for the
> existing strscpy() call unnecessary - remove it.
>
> No functional changes intended.
>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> arch/alpha/kernel/setup.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
> index bebdffafaee8..8b51e6ca83d6 100644
> --- a/arch/alpha/kernel/setup.c
> +++ b/arch/alpha/kernel/setup.c
> @@ -468,8 +468,8 @@ setup_arch(char **cmdline_p)
> /*
> * Locate the command line.
> */
> - strscpy(command_line, COMMAND_LINE, sizeof(command_line));
> - strcpy(boot_command_line, command_line);
> + strscpy(command_line, COMMAND_LINE);
> + strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
> *cmdline_p = command_line;
>
> /*
> @@ -511,7 +511,7 @@ setup_arch(char **cmdline_p)
> }
>
> /* Replace the command line, now that we've killed it with strsep. */
> - strcpy(command_line, boot_command_line);
> + strscpy(command_line, boot_command_line);
>
> /* If we want SRM console printk echoing early, do it now. */
> if (alpha_using_srm && srmcons_output) {
> --
> 2.50.1
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-30 19:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 12:20 [PATCH RESEND] alpha: Replace strcpy() with strscpy() in setup_arch() Thorsten Blum
-- strict thread matches above, loose matches on Subject: below --
2025-06-19 14:58 Thorsten Blum
2025-07-16 21:11 Thorsten Blum
2025-08-17 23:17 Thorsten Blum
2025-08-30 19:11 ` Magnus Lindholm
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).