From: Thorsten Blum <thorsten.blum@linux.dev>
To: Linus Walleij <linusw@kernel.org>, Bartosz Golaszewski <brgl@kernel.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] gpiolib: replace snprintf("%s") with strscpy
Date: Sun, 22 Feb 2026 18:03:27 +0100 [thread overview]
Message-ID: <20260222170327.281576-2-thorsten.blum@linux.dev> (raw)
Replace snprintf("%s", ...) with strscpy() for direct string copying.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/gpio/gpiolib.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 3abb90385829..8d1a762f9d11 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/spinlock.h>
+#include <linux/string.h>
#include <linux/srcu.h>
#include <linux/workqueue.h>
@@ -107,7 +108,7 @@ extern const char *const gpio_suffixes[];
if (con_id) \
snprintf(propname, sizeof(propname), "%s-%s", con_id, __gs); \
else \
- snprintf(propname, sizeof(propname), "%s", __gs); \
+ strscpy(propname, __gs); \
1; \
}); \
__suffixes++)
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
next reply other threads:[~2026-02-22 17:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-22 17:03 Thorsten Blum [this message]
2026-02-23 9:57 ` [PATCH] gpiolib: replace snprintf("%s") with strscpy Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260222170327.281576-2-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox