mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mariia Nikitash <nikitash.mariiaw@gmail.com>
To: mchehab@kernel.org
Cc: 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,
	Mariia Nikitash <nikitash.mariiaw@gmail.com>
Subject: [PATCH v3] media: siano: Replace strlcat() with seq_buf in sms_ir_init()
Date: Thu,  5 Nov 2026 20:16:53 -0800	[thread overview]
Message-ID: <20261106041653.439536-1-nikitash.mariiaw@gmail.com> (raw)
In-Reply-To: <20261104090239.311074-1-nikitash.mariaw@gmail.com>

In preparation for removing the deprecated strlcat() API[1],
replace the strscpy() and strlcat() calls with seq_buf operations
to construct the IR device path.

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>
---
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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/common/siano/smsir.c b/drivers/media/common/siano/smsir.c
index 283770d583d5..faca379ceebc 100644
--- a/drivers/media/common/siano/smsir.c
+++ b/drivers/media/common/siano/smsir.c
@@ -12,6 +12,7 @@
 
 #include "smscoreapi.h"
 
+#include <linux/seq_buf.h>
 #include <linux/types.h>
 #include <linux/input.h>
 
@@ -41,6 +42,7 @@ int sms_ir_init(struct smscore_device_t *coredev)
 	int err;
 	int board_id = smscore_get_board_id(coredev);
 	struct rc_dev *dev;
+	struct seq_buf s;
 
 	pr_debug("Allocating rc device\n");
 	dev = rc_allocate_device(RC_DRIVER_IR_RAW);
@@ -55,8 +57,10 @@ 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));
+	seq_buf_init(&s, coredev->ir.phys, sizeof(coredev->ir.phys));
+	seq_buf_puts(&s, coredev->devpath);
+	seq_buf_puts(&s, "/ir0");
+	seq_buf_terminate(&s);
 
 	dev->device_name = coredev->ir.name;
 	dev->input_phys = coredev->ir.phys;
-- 
2.43.0


           reply	other threads:[~2026-11-06  4:17 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20261104090239.311074-1-nikitash.mariaw@gmail.com>]

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=20261106041653.439536-1-nikitash.mariiaw@gmail.com \
    --to=nikitash.mariiaw@gmail.com \
    --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=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 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®