> Date: 2026-11-06 19:39:28-0800 > From: Mariia Nikitash > > 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 Reviewed-by: Alejandro Colomar 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 > > --