mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: caiaq: Use strscpy() in snd_usb_caiaq_input_init()
@ 2026-10-21 10:39 Thorsten Blum
  2026-10-21 12:58 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-10-21 10:39 UTC (permalink / raw)
  To: Daniel Mack, Jaroslav Kysela, Takashi Iwai
  Cc: Thorsten Blum, linux-sound, linux-kernel

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@kernel.org>
---
 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;

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

* Re: [PATCH] ALSA: caiaq: Use strscpy() in snd_usb_caiaq_input_init()
  2026-10-21 10:39 [PATCH] ALSA: caiaq: Use strscpy() in snd_usb_caiaq_input_init() Thorsten Blum
@ 2026-10-21 12:58 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-10-21 12:58 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Daniel Mack, Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel

On Wed, 21 Oct 2026 12:39:29 +0200,
Thorsten Blum wrote:
> 
> 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@kernel.org>

Applied now.  Thanks.


Takashi

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

end of thread, other threads:[~2026-10-21 12:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 10:39 [PATCH] ALSA: caiaq: Use strscpy() in snd_usb_caiaq_input_init() Thorsten Blum
2026-10-21 12:58 ` Takashi Iwai

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®