Skip to contentSkip to conversation

ALSA: caiaq: Use strscpy() in snd_usb_caiaq_input_init()

PATCH In review Thorsten Blum 2 participants 2 messages Oct 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: caiaq: Use strscpy() in snd_usb_caiaq_input_init()

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.

---
 sound/usb/caiaq/input.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
sound/usb/caiaq/input.c +4 -2
index 8d924330c54c..e2aa09d3de61 100644
@@ -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;