linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] m68k: mm: Replace strcpy() with strscpy() in hardware_proc_show()
@ 2025-04-21 12:28 Thorsten Blum
  2025-04-21 13:02 ` Jean-Michel Hautbois
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2025-04-21 12:28 UTC (permalink / raw)
  To: Geert Uytterhoeven, Thorsten Blum, Jean-Michel Hautbois,
	Kees Cook, Greg Ungerer
  Cc: linux-hardening, linux-m68k, linux-kernel

strcpy() is deprecated; use strscpy() instead.

Link: https://github.com/KSPP/linux/issues/88
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/m68k/kernel/setup_mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 0fba32552836..c7e8de0d34bb 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -484,7 +484,7 @@ static int hardware_proc_show(struct seq_file *m, void *v)
 	if (mach_get_model)
 		mach_get_model(model);
 	else
-		strcpy(model, "Unknown m68k");
+		strscpy(model, "Unknown m68k");
 
 	seq_printf(m, "Model:\t\t%s\n", model);
 	for (mem = 0, i = 0; i < m68k_num_memory; i++)
-- 
2.49.0


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

* Re: [PATCH] m68k: mm: Replace strcpy() with strscpy() in hardware_proc_show()
  2025-04-21 12:28 [PATCH] m68k: mm: Replace strcpy() with strscpy() in hardware_proc_show() Thorsten Blum
@ 2025-04-21 13:02 ` Jean-Michel Hautbois
  2025-04-21 20:35   ` Michael Schmitz
  2025-04-22  7:03   ` Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Michel Hautbois @ 2025-04-21 13:02 UTC (permalink / raw)
  To: Thorsten Blum, Geert Uytterhoeven, Kees Cook, Greg Ungerer
  Cc: linux-hardening, linux-m68k, linux-kernel

Hi Thorsten,

On 21/04/2025 14:28, Thorsten Blum wrote:
> strcpy() is deprecated; use strscpy() instead.
> 
> Link: https://github.com/KSPP/linux/issues/88
> Cc: linux-hardening@vger.kernel.org
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>   arch/m68k/kernel/setup_mm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> index 0fba32552836..c7e8de0d34bb 100644
> --- a/arch/m68k/kernel/setup_mm.c
> +++ b/arch/m68k/kernel/setup_mm.c
> @@ -484,7 +484,7 @@ static int hardware_proc_show(struct seq_file *m, void *v)
>   	if (mach_get_model)
>   		mach_get_model(model);
>   	else
> -		strcpy(model, "Unknown m68k");
> +		strscpy(model, "Unknown m68k");
>   
>   	seq_printf(m, "Model:\t\t%s\n", model);
>   	for (mem = 0, i = 0; i < m68k_num_memory; i++)

As we are not using the return value, I think it is a safe replacement.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>

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

* Re: [PATCH] m68k: mm: Replace strcpy() with strscpy() in hardware_proc_show()
  2025-04-21 13:02 ` Jean-Michel Hautbois
@ 2025-04-21 20:35   ` Michael Schmitz
  2025-04-21 20:54     ` Jean-Michel Hautbois
  2025-04-22  7:03   ` Geert Uytterhoeven
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Schmitz @ 2025-04-21 20:35 UTC (permalink / raw)
  To: Jean-Michel Hautbois; +Cc: Thorsten Blum, Geert Uytterhoeven, linux-m68k

Jean-Michel,

Am 22.04.2025 um 01:02 schrieb Jean-Michel Hautbois:

> As we are not using the return value, I think it is a safe replacement.
>
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>

Would not 'Reviewed-by' be more appropriate here?

Cheers,

	Michael



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

* Re: [PATCH] m68k: mm: Replace strcpy() with strscpy() in hardware_proc_show()
  2025-04-21 20:35   ` Michael Schmitz
@ 2025-04-21 20:54     ` Jean-Michel Hautbois
  0 siblings, 0 replies; 5+ messages in thread
From: Jean-Michel Hautbois @ 2025-04-21 20:54 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Thorsten Blum, Geert Uytterhoeven, linux-m68k

Hi Michael,

On 21/04/2025 22:35, Michael Schmitz wrote:
> Jean-Michel,
> 
> Am 22.04.2025 um 01:02 schrieb Jean-Michel Hautbois:
> 
>> As we are not using the return value, I think it is a safe replacement.
>>
>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
> 
> Would not 'Reviewed-by' be more appropriate here?
> 
Oh my, indeed, not enough sleeping lately :-/ !

JM

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

* Re: [PATCH] m68k: mm: Replace strcpy() with strscpy() in hardware_proc_show()
  2025-04-21 13:02 ` Jean-Michel Hautbois
  2025-04-21 20:35   ` Michael Schmitz
@ 2025-04-22  7:03   ` Geert Uytterhoeven
  1 sibling, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2025-04-22  7:03 UTC (permalink / raw)
  To: Jean-Michel Hautbois
  Cc: Thorsten Blum, Kees Cook, Greg Ungerer, linux-hardening,
	linux-m68k, linux-kernel

Hi Jean-Michel,

On Mon, 21 Apr 2025 at 15:02, Jean-Michel Hautbois
<jeanmichel.hautbois@yoseli.org> wrote:
> On 21/04/2025 14:28, Thorsten Blum wrote:
> > strcpy() is deprecated; use strscpy() instead.
> >
> > Link: https://github.com/KSPP/linux/issues/88
> > Cc: linux-hardening@vger.kernel.org
> > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > ---
> >   arch/m68k/kernel/setup_mm.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> > index 0fba32552836..c7e8de0d34bb 100644
> > --- a/arch/m68k/kernel/setup_mm.c
> > +++ b/arch/m68k/kernel/setup_mm.c
> > @@ -484,7 +484,7 @@ static int hardware_proc_show(struct seq_file *m, void *v)
> >       if (mach_get_model)
> >               mach_get_model(model);
> >       else
> > -             strcpy(model, "Unknown m68k");
> > +             strscpy(model, "Unknown m68k");
> >
> >       seq_printf(m, "Model:\t\t%s\n", model);
> >       for (mem = 0, i = 0; i < m68k_num_memory; i++)
>
> As we are not using the return value, I think it is a safe replacement.

strcpy() and strscpy() not only differ in return value: the (optional)
third parameter of strscpy() specifies the destination buffer size.
When not passed, the size is taken from the actual destination buffer.

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k tree for v6.16.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2025-04-22  7:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-21 12:28 [PATCH] m68k: mm: Replace strcpy() with strscpy() in hardware_proc_show() Thorsten Blum
2025-04-21 13:02 ` Jean-Michel Hautbois
2025-04-21 20:35   ` Michael Schmitz
2025-04-21 20:54     ` Jean-Michel Hautbois
2025-04-22  7:03   ` Geert Uytterhoeven

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