All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx+linux-hardening@kernel.org>
To: Mariia Nikitash <nikitash.mariiaw@gmail.com>
Cc: 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,
	alx@kernel.org, shlomojune6@gmail.com
Subject: Re: [PATCH v4] media: siano: Replace strlcat() with scnprintf() in sms_ir_init()
Date: Sat, 7 Nov 2026 08:35:46 +0100	[thread overview]
Message-ID: <au7Uqao19mXJ3Sxy@debian> (raw)
In-Reply-To: <20261107033928.13891-1-nikitash.mariiaw@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]

> Date: 2026-11-06 19:39:28-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 bounded scnprintf()
> call to construct the IR device path.
> 
> This preserves the original NUL-terminated output, including partial
> or omitted "/ir0" suffixes when the 32-byte buffer is too small.
> 
> 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>


Cheers,
Alex

> ---
> Changes in v4:
> - Replace seq_buf with scnprintf(), as suggested by David Laight
>   and Kees Cook.
> - Remove the unused seq_buf include and local variable.
> 
> Changes in v3:
> - Replace snprintf() with seq_buf operations after reproducing
>   the GCC -Wformat-truncation warning noted by David Laight.
> - Drop the previous Reviewed-by tags due to the implementation change.
> 
> Changes in v2:
> - No code changes.
> - Remove the statement about buffer capacities from the commit message.
> - Add Reviewed-by tags from Alejandro Colomar and Shihuang Liu.
> 
>  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..6952871c5816 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));
> +	scnprintf(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
> 
> 

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-11-07  7:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  9:02 [PATCH] media: siano: Replace strlcat() with snprintf() in sms_ir_init() Mariia Nikitash
2026-11-04 11:25 ` Alejandro Colomar
2026-11-04 19:01   ` Mariia Nikitash
2026-11-05 11:32   ` David Laight
2026-11-06  4:08     ` Mariia Nikitash
     [not found]     ` <CAPDEY+X7q2yeWaa7J=Nre+pQqUa2C760Hh9NovdGNSQ=VsEr8w@mail.gmail.com>
2026-11-06 10:27       ` David Laight
2026-11-06 16:06         ` Kees Cook
2026-11-07  3:50           ` Mariia Nikitash
2026-11-04 16:33 ` Shihuang Liu
2026-11-04 18:50 ` [PATCH v2] " Mariia Nikitash
2026-11-07  3:39 ` [PATCH v4] media: siano: Replace strlcat() with scnprintf() " Mariia Nikitash
2026-11-07  7:35   ` Alejandro Colomar [this message]
2026-11-07 10:28   ` Shihuang Liu
2026-11-12 18:23   ` Kees Cook

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=au7Uqao19mXJ3Sxy@debian \
    --to=alx+linux-hardening@kernel.org \
    --cc=alx@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 \
    --cc=shlomojune6@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 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.