From: Alejandro Colomar <alx+linux-hardening@kernel.org>
To: Mariia Nikitash <nikitash.mariiaw@gmail.com>
Cc: nicolas.dufresne@collabora.com, benjamin.gaignard@collabora.com,
p.zabel@pengutronix.de, mchehab@kernel.org,
hverkuil+cisco@kernel.org, linux-media@vger.kernel.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org, kees@kernel.org,
justinstitt@google.com, morbo@google.com,
david.laight.linux@gmail.com
Subject: Re: [PATCH v2] media: verisilicon: Replace strlcat() with scnprintf()
Date: Wed, 11 Nov 2026 11:35:55 +0100 [thread overview]
Message-ID: <avRE7QDuHyK2aFUo@devuan> (raw)
In-Reply-To: <20261111032446.29803-1-nikitash.mariiaw@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]
Hi Mariia,
> Date: 2026-11-10 19:24:46-0800
> From: Mariia Nikitash <nikitash.mariiaw@gmail.com>
>
> In preparation for removing the deprecated strlcat() API [1], replace the
> strscpy() and strlcat() calls in hantro_add_func() with a single
> scnprintf() call.
>
> This preserves the resulting string, including NUL termination
> and truncation behavior.
>
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Mariia Nikitash <nikitash.mariiaw@gmail.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Have a lovely day!
Alex
> ---
> Changes in v2:
> - Replace seq_buf with a single scnprintf() call, as suggested
> by Hans Verkuil.
>
> drivers/media/platform/verisilicon/hantro_drv.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
> index 26e5d5547466..d8854ceb4fed 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
> @@ -902,9 +902,8 @@ static int hantro_add_func(struct hantro_dev *vpu, unsigned int funcid)
> vfd->vfl_dir = VFL_DIR_M2M;
> vfd->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
> vfd->ioctl_ops = &hantro_ioctl_ops;
> - strscpy(vfd->name, match->compatible, sizeof(vfd->name));
> - strlcat(vfd->name, funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ?
> - "-enc" : "-dec", sizeof(vfd->name));
> + scnprintf(vfd->name, sizeof(vfd->name), "%s%s", match->compatible,
> + funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ? "-enc" : "-dec");
>
> if (funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER) {
> vpu->encoder = func;
> --
> 2.43.0
>
>
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Alejandro Colomar <alx+linux-hardening@kernel.org>
To: Mariia Nikitash <nikitash.mariiaw@gmail.com>
Cc: nicolas.dufresne@collabora.com, benjamin.gaignard@collabora.com,
p.zabel@pengutronix.de, mchehab@kernel.org,
hverkuil+cisco@kernel.org, linux-media@vger.kernel.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org, kees@kernel.org,
justinstitt@google.com, morbo@google.com,
david.laight.linux@gmail.com
Subject: Re: [PATCH v2] media: verisilicon: Replace strlcat() with scnprintf()
Date: Wed, 11 Nov 2026 11:35:55 +0100 [thread overview]
Message-ID: <avRE7QDuHyK2aFUo@devuan> (raw)
In-Reply-To: <20261111032446.29803-1-nikitash.mariiaw@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1787 bytes --]
Hi Mariia,
> Date: 2026-11-10 19:24:46-0800
> From: Mariia Nikitash <nikitash.mariiaw@gmail.com>
>
> In preparation for removing the deprecated strlcat() API [1], replace the
> strscpy() and strlcat() calls in hantro_add_func() with a single
> scnprintf() call.
>
> This preserves the resulting string, including NUL termination
> and truncation behavior.
>
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Mariia Nikitash <nikitash.mariiaw@gmail.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Have a lovely day!
Alex
> ---
> Changes in v2:
> - Replace seq_buf with a single scnprintf() call, as suggested
> by Hans Verkuil.
>
> drivers/media/platform/verisilicon/hantro_drv.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
> index 26e5d5547466..d8854ceb4fed 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
> @@ -902,9 +902,8 @@ static int hantro_add_func(struct hantro_dev *vpu, unsigned int funcid)
> vfd->vfl_dir = VFL_DIR_M2M;
> vfd->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
> vfd->ioctl_ops = &hantro_ioctl_ops;
> - strscpy(vfd->name, match->compatible, sizeof(vfd->name));
> - strlcat(vfd->name, funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ?
> - "-enc" : "-dec", sizeof(vfd->name));
> + scnprintf(vfd->name, sizeof(vfd->name), "%s%s", match->compatible,
> + funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER ? "-enc" : "-dec");
>
> if (funcid == MEDIA_ENT_F_PROC_VIDEO_ENCODER) {
> vpu->encoder = func;
> --
> 2.43.0
>
>
--
<https://www.alejandro-colomar.es>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2026-11-11 10:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 8:45 [PATCH] media: verisilicon: Replace strlcat() with seq_buf Mariia Nikitash
2026-11-05 8:45 ` Mariia Nikitash
2026-11-08 20:08 ` David Laight
2026-11-08 20:08 ` David Laight
2026-11-10 10:13 ` Hans Verkuil
2026-11-10 10:13 ` Hans Verkuil
2026-11-10 18:27 ` Mariia Nikitash
2026-11-10 18:27 ` Mariia Nikitash
2026-11-12 17:45 ` Kees Cook
2026-11-12 17:45 ` Kees Cook
2026-11-11 3:24 ` [PATCH v2] media: verisilicon: Replace strlcat() with scnprintf() Mariia Nikitash
2026-11-11 3:24 ` Mariia Nikitash
2026-11-11 10:35 ` Alejandro Colomar [this message]
2026-11-11 10:35 ` Alejandro Colomar
2026-11-11 22:04 ` Thorsten Blum
2026-11-11 22:04 ` Thorsten Blum
2026-11-12 17:42 ` Kees Cook
2026-11-12 17:42 ` Kees Cook
2026-11-11 23:27 ` [PATCH] media: verisilicon: Replace strlcat() with seq_buf Justin Stitt
2026-11-11 23:27 ` Justin Stitt
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=avRE7QDuHyK2aFUo@devuan \
--to=alx+linux-hardening@kernel.org \
--cc=benjamin.gaignard@collabora.com \
--cc=david.laight.linux@gmail.com \
--cc=hverkuil+cisco@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=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=morbo@google.com \
--cc=nicolas.dufresne@collabora.com \
--cc=nikitash.mariiaw@gmail.com \
--cc=p.zabel@pengutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.