All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: gpio: replace strncpy with strscpy
@ 2026-05-04 19:52 Lucas Poupeau
  2026-05-04 20:18 ` Maxwell Doose
  0 siblings, 1 reply; 7+ messages in thread
From: Lucas Poupeau @ 2026-05-04 19:52 UTC (permalink / raw)
  To: linus.walleij, brgl; +Cc: linux-gpio, linux-kernel, Lucas Poupeau

Replace strncpy with strscpy in gpio-utils.c. strscpy is the preferred
way to copy strings in the kernel as it guarantees NUL-termination and
is more robust.

Reported by checkpatch.pl.

Signed-off-by: Lucas Poupeau <lucasp.linux@gmail.com>
---
 tools/gpio/gpio-utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/gpio/gpio-utils.c b/tools/gpio/gpio-utils.c
index 4096bcd511d1..d5d194be7cc2 100644
--- a/tools/gpio/gpio-utils.c
+++ b/tools/gpio/gpio-utils.c
@@ -82,7 +82,7 @@ int gpiotools_request_line(const char *device_name, unsigned int *lines,
 		req.offsets[i] = lines[i];
 
 	req.config = *config;
-	strcpy(req.consumer, consumer);
+	strscpy(req.consumer, consumer);
 	req.num_lines = num_lines;
 
 	ret = ioctl(fd, GPIO_V2_GET_LINE_IOCTL, &req);
-- 
2.54.0


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

end of thread, other threads:[~2026-05-05 13:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 19:52 [PATCH] tools: gpio: replace strncpy with strscpy Lucas Poupeau
2026-05-04 20:18 ` Maxwell Doose
     [not found]   ` <CAKYXYMRX-oV6iO+Kh+dV7_2BfsY9gjdXMw6cueOgYw2hjLWeaQ@mail.gmail.com>
2026-05-04 20:54     ` Maxwell Doose
2026-05-04 21:00       ` Maxwell Doose
     [not found]         ` <CAKYXYMQQ2UxLJw=2O2y=fLL6Kpp3eUiaH7Rx4MF5H7wcoYzcLQ@mail.gmail.com>
2026-05-04 21:14           ` Maxwell Doose
2026-05-05 10:57             ` Bartosz Golaszewski
2026-05-05 13:15               ` Maxwell Doose

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.