public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: audio_helper.c: Replace strlcpy() with strscpy()
@ 2021-01-09 13:27 B K Karthik
  2021-01-27 12:00 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: B K Karthik @ 2021-01-09 13:27 UTC (permalink / raw)
  To: Johan Hovold, Alex Elder, Greg Kroah-Hartman, greybus-dev, devel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]

In gbaudio_remove_controls() , replace the usage of strlcpy() with
strscpy() because strlcpy() only limits the *destination*
size, and the source is always read fully.

https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
was quoted by checkpatch while showing this warning.

Signed-off-by: B K Karthik <bkkarthik@pesu.pes.edu>
---
 drivers/staging/greybus/audio_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c
index 3011b8abce38..1ed4772d2771 100644
--- a/drivers/staging/greybus/audio_helper.c
+++ b/drivers/staging/greybus/audio_helper.c
@@ -166,7 +166,7 @@ static int gbaudio_remove_controls(struct snd_card *card, struct device *dev,
 			snprintf(id.name, sizeof(id.name), "%s %s", prefix,
 				 control->name);
 		else
-			strlcpy(id.name, control->name, sizeof(id.name));
+			strscpy(id.name, control->name, sizeof(id.name));
 		id.numid = 0;
 		id.iface = control->iface;
 		id.device = control->device;
-- 
2.17.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2021-01-27 12:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-09 13:27 [PATCH] staging: greybus: audio_helper.c: Replace strlcpy() with strscpy() B K Karthik
2021-01-27 12:00 ` Greg Kroah-Hartman

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