From: Alejandro Colomar <alx+linux-hardening@kernel.org>
To: Kees Cook <kees@kernel.org>
Cc: David Laight <david.laight.linux@gmail.com>,
Mariia Nikitash <nikitash.mariiaw@gmail.com>,
dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
justinstitt@google.com, morbo@google.com
Subject: Re: [PATCH] Input: mouse: vsxxxaa: Replace strlcat() with strscpy()
Date: Thu, 12 Nov 2026 22:21:35 +0100 [thread overview]
Message-ID: <avYtm-vs_V0dPfyR@devuan> (raw)
In-Reply-To: <202611121026.23C58B347@keescook>
[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]
Hi Kees, Mariia,
> Date: 2026-11-12 10:27:58-0800
> From: Kees Cook <kees@kernel.org>
>
> On Thu, Nov 05, 2026 at 11:28:13AM +0000, David Laight wrote:
> > On Tue, 3 Nov 2026 22:23:18 -0800
> > Mariia Nikitash <nikitash.mariiaw@gmail.com> wrote:
> >
> > > In preparation for removing the deprecated strlcat() API[1], use
> > > strscpy() to initialize the mouse device name.
> > >
> > > The destination is zero-initialized, and the constant string fits
> > > within the buffer. Since the return value is unused, this preserves
> > > the existing behavior.
> > >
> > > Link: https://github.com/KSPP/linux/issues/370 [1]
> > > Signed-off-by: Mariia Nikitash <nikitash.mariiaw@gmail.com>
> > > ---
> > > drivers/input/mouse/vsxxxaa.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
> > > index 042a17fe81db..b3a0d7ff5738 100644
> > > --- a/drivers/input/mouse/vsxxxaa.c
> > > +++ b/drivers/input/mouse/vsxxxaa.c
> > > @@ -463,8 +463,8 @@ static int vsxxxaa_connect(struct serio *serio, struct serio_driver *drv)
> > >
> > > mouse->dev = input_dev;
> > > mouse->serio = serio;
> > > - strlcat(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
> > > - sizeof(mouse->name));
> > > + strscpy(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
> > > + sizeof(mouse->name));
> >
> > You might as well use the 2 argument form.
>
> I'd agree: this is a true array, so the sizeof() can be dropped. But
> it's also exactly the same binary output, so I'm fine either way:
Indeed, the 2-arg strscpy() call would be much safer. I'd prefer using
it, since we can.
Have a lovely night!
Alex
>
> Reviewed-by: Kees Cook <kees@kernel.org>
>
> And I echo the surprise over strlcat being used on an empty string. :P
>
> --
> Kees Cook
>
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-11-12 21:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 6:23 [PATCH] Input: mouse: vsxxxaa: Replace strlcat() with strscpy() Mariia Nikitash
2026-11-04 11:21 ` Alejandro Colomar
2026-11-04 16:33 ` Shihuang Liu
2026-11-05 11:28 ` David Laight
2026-11-05 11:49 ` Alejandro Colomar
2026-11-05 20:53 ` David Laight
2026-11-05 21:39 ` Alejandro Colomar
2026-11-12 18:27 ` Kees Cook
2026-11-12 21:21 ` Alejandro Colomar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avYtm-vs_V0dPfyR@devuan \
--to=alx+linux-hardening@kernel.org \
--cc=david.laight.linux@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=morbo@google.com \
--cc=nikitash.mariiaw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox