[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMuHMdWxdhTrxHuP5AmZEj2c+RRnUf0qfwsdmJ4CJNGg2AwXug@mail.gmail.com>
Date: Tue, 22 Apr 2025 09:03:38 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Jean-Michel Hautbois <jeanmichel.hautbois@...eli.org>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>, Kees Cook <kees@...nel.org>,
Greg Ungerer <gerg@...ux-m68k.org>, linux-hardening@...r.kernel.org,
linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] m68k: mm: Replace strcpy() with strscpy() in hardware_proc_show()
Hi Jean-Michel,
On Mon, 21 Apr 2025 at 15:02, Jean-Michel Hautbois
<jeanmichel.hautbois@...eli.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@...r.kernel.org
> > Signed-off-by: Thorsten Blum <thorsten.blum@...ux.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@...ux-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@...ux-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
Powered by blists - more mailing lists