[PATCH] ALSA: caiaq: Use strscpy() in snd_usb_caiaq_input_init()

From: Thorsten Blum

Date: Wed Oct 21 2026 - 06:42:57 EST


To prepare for removing strlcat() from the kernel [1], use strscpy()
instead with the length returned by usb_make_path() as the append
offset.

No functional change.

Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
---
sound/usb/caiaq/input.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c
index 8d924330c54c..e2aa09d3de61 100644
--- a/sound/usb/caiaq/input.c
+++ b/sound/usb/caiaq/input.c
@@ -605,13 +605,15 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev)
struct usb_device *usb_dev = cdev->chip.dev;
struct input_dev *input;
int i, ret = 0;
+ int len;

input = input_allocate_device();
if (!input)
return -ENOMEM;

- usb_make_path(usb_dev, cdev->phys, sizeof(cdev->phys));
- strlcat(cdev->phys, "/input0", sizeof(cdev->phys));
+ len = usb_make_path(usb_dev, cdev->phys, sizeof(cdev->phys));
+ if (len >= 0)
+ strscpy(cdev->phys + len, "/input0", sizeof(cdev->phys) - len);

input->name = cdev->product_name;
input->phys = cdev->phys;