Linux USB
 help / color / mirror / Atom feed
* [PATCH v2 RESEND 0/6] USB: add usb_make_subpath() to replace strlcat() in input drivers
       [not found] <20261021123146.17202-1-shlomojune6@gmail.com>
@ 2026-10-22  7:09 ` Shihuang Liu
  2026-10-22  7:09   ` [PATCH v2 RESEND 1/6] USB: add usb_make_subpath() for formatted device subpaths Shihuang Liu
                     ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Shihuang Liu @ 2026-10-22  7:09 UTC (permalink / raw)
  To: linux-input, linux-usb, linux-hardening, linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Marcus Folkesson,
	Ville Syrjala, Henk Vergonet, Henrik Rydberg, Alejandro Colomar,
	Shihuang Liu

Several USB input drivers build their physical device paths by calling
usb_make_path() and then appending "/input0" or "/input1" with strlcat().

In preparation for removing the deprecated strlcat() API [1], introduce
usb_make_subpath() and convert these callers to use it.

Patch 1 adds the helper in include/linux/usb.h. Patches 2-6 convert the
joystick, misc, mouse, tablet and touchscreen drivers, respectively.

Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>

---
This is a resend of v2 to include the USB maintainers and mailing list
that I missed in the original posting.

Original v2:
https://lore.kernel.org/r/20261021123146.17202-1-shlomojune6@gmail.com/

No changes to the patches since v2

Changes in v2:
  - Add usb_make_subpath() as the first patch in the series.
  - Use the helper instead of open-coding strnlen() and strscpy() in
    each input driver.
  - Link to v1: https://lore.kernel.org/all/20261016170411.51025-1-shlomojune6@gmail.com/

---

Shihuang Liu (6):
  USB: add usb_make_subpath() for formatted device subpaths
  Input: joystick - use usb_make_subpath()
  Input: misc - use usb_make_subpath()
  Input: mouse - use usb_make_subpath()
  Input: tablet - use usb_make_subpath()
  Input: touchscreen - use usb_make_subpath()

 drivers/input/joystick/pxrc.c              |  3 +--
 drivers/input/joystick/xpad.c              |  3 +--
 drivers/input/misc/ati_remote2.c           |  3 +--
 drivers/input/misc/cm109.c                 |  3 +--
 drivers/input/misc/ims-pcu.c               |  6 ++---
 drivers/input/misc/keyspan_remote.c        |  3 +--
 drivers/input/misc/powermate.c             |  3 +--
 drivers/input/misc/yealink.c               |  3 +--
 drivers/input/mouse/appletouch.c           |  3 +--
 drivers/input/mouse/bcm5974.c              |  3 +--
 drivers/input/mouse/synaptics_usb.c        |  3 +--
 drivers/input/tablet/acecad.c              |  3 +--
 drivers/input/tablet/aiptek.c              |  6 ++---
 drivers/input/tablet/hanwang.c             |  3 +--
 drivers/input/tablet/kbtab.c               |  3 +--
 drivers/input/tablet/pegasus_notetaker.c   |  3 +--
 drivers/input/touchscreen/sur40.c          |  3 +--
 drivers/input/touchscreen/usbtouchscreen.c |  3 +--
 include/linux/usb.h                        | 29 ++++++++++++++++++++++
 19 files changed, 49 insertions(+), 40 deletions(-)

-- 
2.43.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 RESEND 1/6] USB: add usb_make_subpath() for formatted device subpaths
  2026-10-22  7:09 ` [PATCH v2 RESEND 0/6] USB: add usb_make_subpath() to replace strlcat() in input drivers Shihuang Liu
@ 2026-10-22  7:09   ` Shihuang Liu
  2026-10-22  7:14     ` sashiko-bot
  2026-10-22  7:09   ` [PATCH v2 RESEND 2/6] Input: joystick - use usb_make_subpath() Shihuang Liu
                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Shihuang Liu @ 2026-10-22  7:09 UTC (permalink / raw)
  To: linux-input, linux-usb, linux-hardening, linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Marcus Folkesson,
	Ville Syrjala, Henk Vergonet, Henrik Rydberg, Alejandro Colomar,
	Shihuang Liu

USB drivers often build device paths by calling usb_make_path() :and
then appending a subpath. Several callers use the deprecated strlcat()
API for this.

In preparation for removing the deprecated strlcat() API[1], add
usb_make_subpath() to format the USB device path.

Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>
---
 include/linux/usb.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/include/linux/usb.h b/include/linux/usb.h
index 1da4ad1610bca..c90ccea0cdbf6 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -14,6 +14,7 @@
 #include <linux/errno.h>        /* for -ENODEV */
 #include <linux/delay.h>	/* for mdelay() */
 #include <linux/interrupt.h>	/* for in_interrupt() */
+#include <linux/stdarg.h>	/* for va_list */
 #include <linux/list.h>		/* for struct list_head */
 #include <linux/kref.h>		/* for struct kref */
 #include <linux/device.h>	/* for struct device */
@@ -987,6 +988,34 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
 	return (actual >= (int)size) ? -1 : actual;
 }
 
+/**
+ * usb_make_subpath - returns a stable device path and formatted subpath
+ * @dev: the device whose path is being constructed
+ * @buf: where to put the string
+ * @size: how big is "buf"?
+ * @fmt: format string for the subpath, without the leading slash
+ * @...: arguments for @fmt
+ *
+ * Return: Length of the string (> 0) or negative if size was too small.
+ */
+static inline __printf(4, 5)
+int usb_make_subpath(struct usb_device *dev, char *buf, size_t size,
+		     const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+	int actual;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+	actual = snprintf(buf, size, "usb-%s-%s/%pV", dev->bus->bus_name,
+			  dev->devpath, &vaf);
+	va_end(args);
+
+	return (actual >= (int)size) ? -1 : actual;
+}
+
 /*-------------------------------------------------------------------------*/
 
 #define USB_DEVICE_ID_MATCH_DEVICE \
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 RESEND 2/6] Input: joystick - use usb_make_subpath()
  2026-10-22  7:09 ` [PATCH v2 RESEND 0/6] USB: add usb_make_subpath() to replace strlcat() in input drivers Shihuang Liu
  2026-10-22  7:09   ` [PATCH v2 RESEND 1/6] USB: add usb_make_subpath() for formatted device subpaths Shihuang Liu
@ 2026-10-22  7:09   ` Shihuang Liu
  2026-10-22  7:12     ` sashiko-bot
  2026-10-22  7:09   ` [PATCH v2 RESEND 3/6] Input: misc " Shihuang Liu
                     ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Shihuang Liu @ 2026-10-22  7:09 UTC (permalink / raw)
  To: linux-input, linux-usb, linux-hardening, linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Marcus Folkesson,
	Ville Syrjala, Henk Vergonet, Henrik Rydberg, Alejandro Colomar,
	Shihuang Liu

The pxrc and xpad drivers build their input device physical paths
by appending "/input0" with strlcat() after usb_make_path().

In preparation for removing the deprecated strlcat() API [1],
replace each pair of calls with usb_make_subpath(). The helper
formats the USB path and the "input0" subpath in one call,
avoiding a separate buffer scan and append operation.

Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>
---
 drivers/input/joystick/pxrc.c | 3 +--
 drivers/input/joystick/xpad.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c
index 52d9eab667b7a..1a11e73d7cd04 100644
--- a/drivers/input/joystick/pxrc.c
+++ b/drivers/input/joystick/pxrc.c
@@ -169,8 +169,7 @@ static int pxrc_probe(struct usb_interface *intf,
 
 	pxrc->input->name = "PXRC Flight Controller Adapter";
 
-	usb_make_path(udev, pxrc->phys, sizeof(pxrc->phys));
-	strlcat(pxrc->phys, "/input0", sizeof(pxrc->phys));
+	usb_make_subpath(udev, pxrc->phys, sizeof(pxrc->phys), "input0");
 	pxrc->input->phys = pxrc->phys;
 
 	usb_to_input_id(udev, &pxrc->input->id);
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index feb8f368f834e..0f7ca5adaeee7 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -2059,8 +2059,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 	if (!xpad)
 		return -ENOMEM;
 
-	usb_make_path(udev, xpad->phys, sizeof(xpad->phys));
-	strlcat(xpad->phys, "/input0", sizeof(xpad->phys));
+	usb_make_subpath(udev, xpad->phys, sizeof(xpad->phys), "input0");
 
 	xpad->idata = usb_alloc_coherent(udev, XPAD_PKT_LEN,
 					 GFP_KERNEL, &xpad->idata_dma);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 RESEND 3/6] Input: misc - use usb_make_subpath()
  2026-10-22  7:09 ` [PATCH v2 RESEND 0/6] USB: add usb_make_subpath() to replace strlcat() in input drivers Shihuang Liu
  2026-10-22  7:09   ` [PATCH v2 RESEND 1/6] USB: add usb_make_subpath() for formatted device subpaths Shihuang Liu
  2026-10-22  7:09   ` [PATCH v2 RESEND 2/6] Input: joystick - use usb_make_subpath() Shihuang Liu
@ 2026-10-22  7:09   ` Shihuang Liu
  2026-10-22  7:12     ` sashiko-bot
  2026-10-22  7:09   ` [PATCH v2 RESEND 4/6] Input: mouse " Shihuang Liu
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Shihuang Liu @ 2026-10-22  7:09 UTC (permalink / raw)
  To: linux-input, linux-usb, linux-hardening, linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Marcus Folkesson,
	Ville Syrjala, Henk Vergonet, Henrik Rydberg, Alejandro Colomar,
	Shihuang Liu

The ati_remote2, cm109, ims-pcu, keyspan_remote, powermate and yealink
drivers build their input device physical paths by appending a subpath
with strlcat() after usb_make_path(). Most use "/input0"; ims-pcu also
uses "/input1" for its gamepad interface.

In preparation for removing the deprecated strlcat() API [1], replace
these pairs of calls with usb_make_subpath(). Pass "input0" or "input1"
as appropriate so the helper constructs each physical path in one call,
avoiding a separate buffer scan and append operation.

Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>
---
 drivers/input/misc/ati_remote2.c    | 3 +--
 drivers/input/misc/cm109.c          | 3 +--
 drivers/input/misc/ims-pcu.c        | 6 ++----
 drivers/input/misc/keyspan_remote.c | 3 +--
 drivers/input/misc/powermate.c      | 3 +--
 drivers/input/misc/yealink.c        | 3 +--
 6 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index 8db2dca84975c..20cb7b8efcc0b 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -822,8 +822,7 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
 	if (r)
 		goto fail3;
 
-	usb_make_path(udev, ar2->phys, sizeof(ar2->phys));
-	strlcat(ar2->phys, "/input0", sizeof(ar2->phys));
+	usb_make_subpath(udev, ar2->phys, sizeof(ar2->phys), "input0");
 
 	strlcat(ar2->name, "ATI Remote Wonder II", sizeof(ar2->name));
 
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index 353d3c1d347d5..06d8f0dab4b37 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -765,8 +765,7 @@ static int cm109_usb_probe(struct usb_interface *intf,
 	dev->urb_ctl->dev = udev;
 
 	/* find out the physical bus location */
-	usb_make_path(udev, dev->phys, sizeof(dev->phys));
-	strlcat(dev->phys, "/input0", sizeof(dev->phys));
+	usb_make_subpath(udev, dev->phys, sizeof(dev->phys), "input0");
 
 	/* register settings for the input device */
 	input_dev->name = nfo->name;
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index b1a0edcc49b4e..e629a327fdd76 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -215,8 +215,7 @@ static int ims_pcu_setup_buttons(struct ims_pcu *pcu,
 	snprintf(buttons->name, sizeof(buttons->name),
 		 "IMS PCU#%d Button Interface", pcu->device_no);
 
-	usb_make_path(pcu->udev, buttons->phys, sizeof(buttons->phys));
-	strlcat(buttons->phys, "/input0", sizeof(buttons->phys));
+	usb_make_subpath(pcu->udev, buttons->phys, sizeof(buttons->phys), "input0");
 
 	memcpy(buttons->keymap, keymap, sizeof(*keymap) * keymap_len);
 
@@ -301,8 +300,7 @@ static int ims_pcu_setup_gamepad(struct ims_pcu *pcu)
 	snprintf(gamepad->name, sizeof(gamepad->name),
 		 "IMS PCU#%d Gamepad Interface", pcu->device_no);
 
-	usb_make_path(pcu->udev, gamepad->phys, sizeof(gamepad->phys));
-	strlcat(gamepad->phys, "/input1", sizeof(gamepad->phys));
+	usb_make_subpath(pcu->udev, gamepad->phys, sizeof(gamepad->phys), "input1");
 
 	input->name = gamepad->name;
 	input->phys = gamepad->phys;
diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
index 70cd6586459ef..68c969657806d 100644
--- a/drivers/input/misc/keyspan_remote.c
+++ b/drivers/input/misc/keyspan_remote.c
@@ -481,8 +481,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
 			 le16_to_cpu(udev->descriptor.idVendor),
 			 le16_to_cpu(udev->descriptor.idProduct));
 
-	usb_make_path(udev, remote->phys, sizeof(remote->phys));
-	strlcat(remote->phys, "/input0", sizeof(remote->phys));
+	usb_make_subpath(udev, remote->phys, sizeof(remote->phys), "input0");
 	memcpy(remote->keymap, keyspan_key_table, sizeof(remote->keymap));
 
 	input_dev->name = remote->name;
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index 754379d2625cf..f004cfca795ec 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -333,8 +333,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
 	pm->intf = intf;
 	pm->input = input_dev;
 
-	usb_make_path(udev, pm->phys, sizeof(pm->phys));
-	strlcat(pm->phys, "/input0", sizeof(pm->phys));
+	usb_make_subpath(udev, pm->phys, sizeof(pm->phys), "input0");
 
 	spin_lock_init(&pm->lock);
 
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 560f895a00cda..9a8ee7a586f44 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -890,8 +890,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	yld->urb_ctl->dev = udev;
 
 	/* find out the physical bus location */
-	usb_make_path(udev, yld->phys, sizeof(yld->phys));
-	strlcat(yld->phys,  "/input0", sizeof(yld->phys));
+	usb_make_subpath(udev, yld->phys, sizeof(yld->phys), "input0");
 
 	/* register settings for the input device */
 	input_dev->name = nfo->name;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 RESEND 4/6] Input: mouse - use usb_make_subpath()
  2026-10-22  7:09 ` [PATCH v2 RESEND 0/6] USB: add usb_make_subpath() to replace strlcat() in input drivers Shihuang Liu
                     ` (2 preceding siblings ...)
  2026-10-22  7:09   ` [PATCH v2 RESEND 3/6] Input: misc " Shihuang Liu
@ 2026-10-22  7:09   ` Shihuang Liu
  2026-10-22  7:12     ` sashiko-bot
  2026-10-22  7:09   ` [PATCH v2 RESEND 5/6] Input: tablet " Shihuang Liu
  2026-10-22  7:09   ` [PATCH v2 RESEND 6/6] Input: touchscreen " Shihuang Liu
  5 siblings, 1 reply; 13+ messages in thread
From: Shihuang Liu @ 2026-10-22  7:09 UTC (permalink / raw)
  To: linux-input, linux-usb, linux-hardening, linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Marcus Folkesson,
	Ville Syrjala, Henk Vergonet, Henrik Rydberg, Alejandro Colomar,
	Shihuang Liu

The appletouch, bcm5974 and synaptics_usb drivers build their input
device physical paths by appending "/input0" with strlcat() after
usb_make_path().

In preparation for removing the deprecated strlcat() API [1],
replace each pair of calls with usb_make_subpath(). The
helper formats the USB path and the "input0" subpath in
one call, avoiding a separate buffer scan and append operation.

Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>
---
 drivers/input/mouse/appletouch.c    | 3 +--
 drivers/input/mouse/bcm5974.c       | 3 +--
 drivers/input/mouse/synaptics_usb.c | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index eebeb57515e1c..b536dfae427de 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -874,8 +874,7 @@ static int atp_probe(struct usb_interface *iface,
 	if (error)
 		goto err_free_buffer;
 
-	usb_make_path(udev, dev->phys, sizeof(dev->phys));
-	strlcat(dev->phys, "/input0", sizeof(dev->phys));
+	usb_make_subpath(udev, dev->phys, sizeof(dev->phys), "input0");
 
 	input_dev->name = "appletouch";
 	input_dev->phys = dev->phys;
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index e772bac3b64c0..0732bf3a97adc 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -989,8 +989,7 @@ static int bcm5974_probe(struct usb_interface *iface,
 	dev->tp_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
 	/* create bcm5974 device */
-	usb_make_path(udev, dev->phys, sizeof(dev->phys));
-	strlcat(dev->phys, "/input0", sizeof(dev->phys));
+	usb_make_subpath(udev, dev->phys, sizeof(dev->phys), "input0");
 
 	input_dev->name = "bcm5974";
 	input_dev->phys = dev->phys;
diff --git a/drivers/input/mouse/synaptics_usb.c b/drivers/input/mouse/synaptics_usb.c
index 880a0c79148cd..7da22118ce576 100644
--- a/drivers/input/mouse/synaptics_usb.c
+++ b/drivers/input/mouse/synaptics_usb.c
@@ -353,8 +353,7 @@ static int synusb_probe(struct usb_interface *intf,
 	if (synusb->flags & SYNUSB_STICK)
 		strlcat(synusb->name, " (Stick)", sizeof(synusb->name));
 
-	usb_make_path(udev, synusb->phys, sizeof(synusb->phys));
-	strlcat(synusb->phys, "/input0", sizeof(synusb->phys));
+	usb_make_subpath(udev, synusb->phys, sizeof(synusb->phys), "input0");
 
 	input_dev->name = synusb->name;
 	input_dev->phys = synusb->phys;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 RESEND 5/6] Input: tablet - use usb_make_subpath()
  2026-10-22  7:09 ` [PATCH v2 RESEND 0/6] USB: add usb_make_subpath() to replace strlcat() in input drivers Shihuang Liu
                     ` (3 preceding siblings ...)
  2026-10-22  7:09   ` [PATCH v2 RESEND 4/6] Input: mouse " Shihuang Liu
@ 2026-10-22  7:09   ` Shihuang Liu
  2026-10-22  7:12     ` sashiko-bot
  2026-10-22  7:09   ` [PATCH v2 RESEND 6/6] Input: touchscreen " Shihuang Liu
  5 siblings, 1 reply; 13+ messages in thread
From: Shihuang Liu @ 2026-10-22  7:09 UTC (permalink / raw)
  To: linux-input, linux-usb, linux-hardening, linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Marcus Folkesson,
	Ville Syrjala, Henk Vergonet, Henrik Rydberg, Alejandro Colomar,
	Shihuang Liu

The acecad, aiptek, hanwang, kbtab and pegasus_notetaker drivers build
their input device physical paths by appending "/input0" with strlcat()
after usb_make_path().

In preparation for removing the deprecated strlcat() API [1], replace
each pair of calls with usb_make_subpath(). The helper formats the USB
path and the "input0" subpath in one call, avoiding a separate buffer
scan and append operation.

Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>
---
 drivers/input/tablet/acecad.c            | 3 +--
 drivers/input/tablet/aiptek.c            | 6 ++----
 drivers/input/tablet/hanwang.c           | 3 +--
 drivers/input/tablet/kbtab.c             | 3 +--
 drivers/input/tablet/pegasus_notetaker.c | 3 +--
 5 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index ba79dff21aac8..c12b0a0181837 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -160,8 +160,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
 		strlcat(acecad->name, dev->product, sizeof(acecad->name));
 	}
 
-	usb_make_path(dev, acecad->phys, sizeof(acecad->phys));
-	strlcat(acecad->phys, "/input0", sizeof(acecad->phys));
+	usb_make_subpath(dev, acecad->phys, sizeof(acecad->phys), "input0");
 
 	input_dev->name = acecad->name;
 	input_dev->phys = acecad->phys;
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index 0c1acb9e6b437..cc68ee82c12c3 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1705,10 +1705,8 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	 * & a tablet, and the inputX number actually will tell
 	 * us something...
 	 */
-	usb_make_path(usbdev, aiptek->features.usbPath,
-			sizeof(aiptek->features.usbPath));
-	strlcat(aiptek->features.usbPath, "/input0",
-		sizeof(aiptek->features.usbPath));
+	usb_make_subpath(usbdev, aiptek->features.usbPath,
+			sizeof(aiptek->features.usbPath), "input0");
 
 	/* Set up client data, pointers to open and close routines
 	 * for the input device.
diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c
index fd5a7e761dcc4..a9521bbc89646 100644
--- a/drivers/input/tablet/hanwang.c
+++ b/drivers/input/tablet/hanwang.c
@@ -350,8 +350,7 @@ static int hanwang_probe(struct usb_interface *intf, const struct usb_device_id
 	hanwang->usbdev = dev;
 	hanwang->dev = input_dev;
 
-	usb_make_path(dev, hanwang->phys, sizeof(hanwang->phys));
-	strlcat(hanwang->phys, "/input0", sizeof(hanwang->phys));
+	usb_make_subpath(dev, hanwang->phys, sizeof(hanwang->phys), "input0");
 
 	strscpy(hanwang->name, hanwang->features->name, sizeof(hanwang->name));
 	input_dev->name = hanwang->name;
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index 6ce70c8e2d7cc..f777118ed7c8f 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -137,8 +137,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
 	kbtab->intf = intf;
 	kbtab->dev = input_dev;
 
-	usb_make_path(dev, kbtab->phys, sizeof(kbtab->phys));
-	strlcat(kbtab->phys, "/input0", sizeof(kbtab->phys));
+	usb_make_subpath(dev, kbtab->phys, sizeof(kbtab->phys), "input0");
 
 	input_dev->name = "KB Gear Tablet";
 	input_dev->phys = kbtab->phys;
diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c
index 85390ae423076..28fbae98f7399 100644
--- a/drivers/input/tablet/pegasus_notetaker.c
+++ b/drivers/input/tablet/pegasus_notetaker.c
@@ -354,8 +354,7 @@ static int pegasus_probe(struct usb_interface *intf,
 			 le16_to_cpu(dev->descriptor.idVendor),
 			 le16_to_cpu(dev->descriptor.idProduct));
 
-	usb_make_path(dev, pegasus->phys, sizeof(pegasus->phys));
-	strlcat(pegasus->phys, "/input0", sizeof(pegasus->phys));
+	usb_make_subpath(dev, pegasus->phys, sizeof(pegasus->phys), "input0");
 
 	INIT_WORK(&pegasus->init, pegasus_init);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 RESEND 6/6] Input: touchscreen - use usb_make_subpath()
  2026-10-22  7:09 ` [PATCH v2 RESEND 0/6] USB: add usb_make_subpath() to replace strlcat() in input drivers Shihuang Liu
                     ` (4 preceding siblings ...)
  2026-10-22  7:09   ` [PATCH v2 RESEND 5/6] Input: tablet " Shihuang Liu
@ 2026-10-22  7:09   ` Shihuang Liu
  2026-10-22  7:12     ` sashiko-bot
  5 siblings, 1 reply; 13+ messages in thread
From: Shihuang Liu @ 2026-10-22  7:09 UTC (permalink / raw)
  To: linux-input, linux-usb, linux-hardening, linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Marcus Folkesson,
	Ville Syrjala, Henk Vergonet, Henrik Rydberg, Alejandro Colomar,
	Shihuang Liu

The sur40 and usbtouchscreen drivers build their input device physical
paths by appending "/input0" with strlcat() after usb_make_path().

In preparation for removing the deprecated strlcat() API [1], replace
each pair of calls with usb_make_subpath(). The helper formats the
USB path and the "input0" subpath in one call, avoiding a separate
buffer scan and append operation.

Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>
---
 drivers/input/touchscreen/sur40.c          | 3 +--
 drivers/input/touchscreen/usbtouchscreen.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index 77ec2c94b91fd..7702eead123e2 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -690,8 +690,7 @@ static int sur40_probe(struct usb_interface *interface,
 	/* Set up regular input device structure */
 	input->name = DRIVER_LONG;
 	usb_to_input_id(usbdev, &input->id);
-	usb_make_path(usbdev, sur40->phys, sizeof(sur40->phys));
-	strlcat(sur40->phys, "/input0", sizeof(sur40->phys));
+	usb_make_subpath(usbdev, sur40->phys, sizeof(sur40->phys), "input0");
 	input->phys = sur40->phys;
 	input->dev.parent = &interface->dev;
 
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 0bbacb517c286..fd2b896675dee 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -1512,8 +1512,7 @@ static int usbtouch_probe(struct usb_interface *intf,
 			 le16_to_cpu(udev->descriptor.idVendor),
 			 le16_to_cpu(udev->descriptor.idProduct));
 
-	usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys));
-	strlcat(usbtouch->phys, "/input0", sizeof(usbtouch->phys));
+	usb_make_subpath(udev, usbtouch->phys, sizeof(usbtouch->phys), "input0");
 
 	input_dev->name = usbtouch->name;
 	input_dev->phys = usbtouch->phys;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 RESEND 2/6] Input: joystick - use usb_make_subpath()
  2026-10-22  7:09   ` [PATCH v2 RESEND 2/6] Input: joystick - use usb_make_subpath() Shihuang Liu
@ 2026-10-22  7:12     ` sashiko-bot
  0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-10-22  7:12 UTC (permalink / raw)
  To: Shihuang Liu, linux-usb

> The pxrc and xpad drivers build their input device physical paths
> by appending "/input0" with strlcat() after usb_make_path().
> 
> In preparation for removing the deprecated strlcat() API [1],
> replace each pair of calls with usb_make_subpath(). The helper
> formats the USB path and the "input0" subpath in one call,
> avoiding a separate buffer scan and append operation.
> 
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022070929.20820-1-shlomojune6@gmail.com?part=2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 RESEND 6/6] Input: touchscreen - use usb_make_subpath()
  2026-10-22  7:09   ` [PATCH v2 RESEND 6/6] Input: touchscreen " Shihuang Liu
@ 2026-10-22  7:12     ` sashiko-bot
  0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-10-22  7:12 UTC (permalink / raw)
  To: Shihuang Liu, linux-usb

> The sur40 and usbtouchscreen drivers build their input device physical
> paths by appending "/input0" with strlcat() after usb_make_path().
> 
> In preparation for removing the deprecated strlcat() API [1], replace
> each pair of calls with usb_make_subpath(). The helper formats the
> USB path and the "input0" subpath in one call, avoiding a separate
> buffer scan and append operation.
> 
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022070929.20820-1-shlomojune6@gmail.com?part=6


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 RESEND 5/6] Input: tablet - use usb_make_subpath()
  2026-10-22  7:09   ` [PATCH v2 RESEND 5/6] Input: tablet " Shihuang Liu
@ 2026-10-22  7:12     ` sashiko-bot
  0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-10-22  7:12 UTC (permalink / raw)
  To: Shihuang Liu, linux-usb

> The acecad, aiptek, hanwang, kbtab and pegasus_notetaker drivers build
> their input device physical paths by appending "/input0" with strlcat()
> after usb_make_path().
> 
> In preparation for removing the deprecated strlcat() API [1], replace
> each pair of calls with usb_make_subpath(). The helper formats the USB
> path and the "input0" subpath in one call, avoiding a separate buffer
> scan and append operation.
> 
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022070929.20820-1-shlomojune6@gmail.com?part=5


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 RESEND 3/6] Input: misc - use usb_make_subpath()
  2026-10-22  7:09   ` [PATCH v2 RESEND 3/6] Input: misc " Shihuang Liu
@ 2026-10-22  7:12     ` sashiko-bot
  0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-10-22  7:12 UTC (permalink / raw)
  To: Shihuang Liu, linux-usb

> The ati_remote2, cm109, ims-pcu, keyspan_remote, powermate and yealink
> drivers build their input device physical paths by appending a subpath
> with strlcat() after usb_make_path(). Most use "/input0"; ims-pcu also
> uses "/input1" for its gamepad interface.
> 
> In preparation for removing the deprecated strlcat() API [1], replace
> these pairs of calls with usb_make_subpath(). Pass "input0" or "input1"
> as appropriate so the helper constructs each physical path in one call,
> avoiding a separate buffer scan and append operation.
> 
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022070929.20820-1-shlomojune6@gmail.com?part=3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 RESEND 4/6] Input: mouse - use usb_make_subpath()
  2026-10-22  7:09   ` [PATCH v2 RESEND 4/6] Input: mouse " Shihuang Liu
@ 2026-10-22  7:12     ` sashiko-bot
  0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-10-22  7:12 UTC (permalink / raw)
  To: Shihuang Liu, linux-usb

> The appletouch, bcm5974 and synaptics_usb drivers build their input
> device physical paths by appending "/input0" with strlcat() after
> usb_make_path().
> 
> In preparation for removing the deprecated strlcat() API [1],
> replace each pair of calls with usb_make_subpath(). The
> helper formats the USB path and the "input0" subpath in
> one call, avoiding a separate buffer scan and append operation.
> 
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022070929.20820-1-shlomojune6@gmail.com?part=4


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 RESEND 1/6] USB: add usb_make_subpath() for formatted device subpaths
  2026-10-22  7:09   ` [PATCH v2 RESEND 1/6] USB: add usb_make_subpath() for formatted device subpaths Shihuang Liu
@ 2026-10-22  7:14     ` sashiko-bot
  0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-10-22  7:14 UTC (permalink / raw)
  To: Shihuang Liu, linux-usb

> USB drivers often build device paths by calling usb_make_path() :and
> then appending a subpath. Several callers use the deprecated strlcat()
> API for this.
> 
> In preparation for removing the deprecated strlcat() API[1], add
> usb_make_subpath() to format the USB device path.
> 
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022070929.20820-1-shlomojune6@gmail.com?part=1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-10-22  7:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261021123146.17202-1-shlomojune6@gmail.com>
2026-10-22  7:09 ` [PATCH v2 RESEND 0/6] USB: add usb_make_subpath() to replace strlcat() in input drivers Shihuang Liu
2026-10-22  7:09   ` [PATCH v2 RESEND 1/6] USB: add usb_make_subpath() for formatted device subpaths Shihuang Liu
2026-10-22  7:14     ` sashiko-bot
2026-10-22  7:09   ` [PATCH v2 RESEND 2/6] Input: joystick - use usb_make_subpath() Shihuang Liu
2026-10-22  7:12     ` sashiko-bot
2026-10-22  7:09   ` [PATCH v2 RESEND 3/6] Input: misc " Shihuang Liu
2026-10-22  7:12     ` sashiko-bot
2026-10-22  7:09   ` [PATCH v2 RESEND 4/6] Input: mouse " Shihuang Liu
2026-10-22  7:12     ` sashiko-bot
2026-10-22  7:09   ` [PATCH v2 RESEND 5/6] Input: tablet " Shihuang Liu
2026-10-22  7:12     ` sashiko-bot
2026-10-22  7:09   ` [PATCH v2 RESEND 6/6] Input: touchscreen " Shihuang Liu
2026-10-22  7:12     ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox