media: siano: Replace strlcat() with seq_buf in sms_ir_init()
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/1 media: siano: Replace strlcat() with seq_buf in sms_ir_init()
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.
---
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(-)
drivers/media/common/siano/smsir.c +6 -2
@@ -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;
Signature · 1 line
2.43.0