From: David Laight <david.laight.linux@gmail.com>
To: Alejandro Colomar <alx+linux-hardening@kernel.org>
Cc: Mariia Nikitash <nikitash.mariiaw@gmail.com>,
mchehab@kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
kees@kernel.org, justinstitt@google.com, morbo@google.com
Subject: Re: [PATCH] media: siano: Replace strlcat() with snprintf() in sms_ir_init()
Date: Thu, 5 Nov 2026 11:32:29 +0000 [thread overview]
Message-ID: <20261105113229.4126d872@pumpkin> (raw)
In-Reply-To: <ausVkYs1-3rJ5Fj0@devuan>
On Wed, 4 Nov 2026 12:25:17 +0100
Alejandro Colomar <alx+linux-hardening@kernel.org> wrote:
> Hi Mariia,
>
> > Date: 2026-11-04 01:02:39-0800
> > From: Mariia Nikitash <nikitash.mariiaw@gmail.com>
> >
> > In preparation for removing the deprecated strlcat() API[1],
> > replace the strscpy() and strlcat() calls with a single snprintf()
> > call to construct the IR device path.
> >
> > Both the source and destination buffers have the same capacity,
>
> The line above seems irrelevant, and potentially confusing.
> The size of the input is not important, because since we're appending
> stuff after it, truncation may actually happen.
And gcc's stupid format overflow check is going to complain.
David
>
> > and the return values are unused. This preserves the resulting
> > string, including truncation behavior.
> >
> > Link: https://github.com/KSPP/linux/issues/370 [1]
> > Signed-off-by: Mariia Nikitash <nikitash.mariiaw@gmail.com>
>
> Except for the small comment above,
>
> Reviewed-by: Alejandro Colomar <alx@kernel.org>
>
>
> Cheers,
> Alex
>
> > ---
> > drivers/media/common/siano/smsir.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/common/siano/smsir.c b/drivers/media/common/siano/smsir.c
> > index 283770d583d5..636ff228108b 100644
> > --- a/drivers/media/common/siano/smsir.c
> > +++ b/drivers/media/common/siano/smsir.c
> > @@ -55,8 +55,8 @@ int sms_ir_init(struct smscore_device_t *coredev)
> > snprintf(coredev->ir.name, sizeof(coredev->ir.name),
> > "SMS IR (%s)", sms_get_board(board_id)->name);
> >
> > - strscpy(coredev->ir.phys, coredev->devpath, sizeof(coredev->ir.phys));
> > - strlcat(coredev->ir.phys, "/ir0", sizeof(coredev->ir.phys));
> > + snprintf(coredev->ir.phys, sizeof(coredev->ir.phys),
> > + "%s/ir0", coredev->devpath);
> >
> > dev->device_name = coredev->ir.name;
> > dev->input_phys = coredev->ir.phys;
> > --
> > 2.43.0
> >
> >
>
next prev parent reply other threads:[~2026-11-05 11:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 9:02 Mariia Nikitash
2026-11-04 11:25 ` Alejandro Colomar
2026-11-04 19:01 ` Mariia Nikitash
2026-11-05 11:32 ` David Laight [this message]
2026-11-06 4:08 ` Mariia Nikitash
2026-11-04 16:33 ` Shihuang Liu
2026-11-04 18:50 ` [PATCH v2] " Mariia Nikitash
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=20261105113229.4126d872@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=alx+linux-hardening@kernel.org \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@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
all inboxes | Powered by JetHome®