From: Lucas Poupeau <lucasp.linux@gmail.com>
To: m32285159@gmail.com, richard.weiyang@gmail.com
Cc: linux-kernel@vger.kernel.org, Lucas Poupeau <lucasp.linux@gmail.com>
Subject: [PATCH] tools: include: add proper strscpy() declaration
Date: Wed, 6 May 2026 18:34:52 +0200 [thread overview]
Message-ID: <20260506163452.53067-1-lucasp.linux@gmail.com> (raw)
Remove the macro hack and add a proper implementation in tools/lib/string.c.
This avoids unsafe strcpy usage when strscpy is expected and fixes
potential compilation warnings regarding str_error_r.
Fixes: 9e3d665 ("memblock test: fix implicit declaration of function 'strscpy'")
Suggested-by: Maxwell Doose <m32285159@gmail.com>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Lucas Poupeau <lucasp.linux@gmail.com>
---
tools/include/linux/string.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h
index 51ad3cf4fa82..d6e53109e786 100644
--- a/tools/include/linux/string.h
+++ b/tools/include/linux/string.h
@@ -12,7 +12,7 @@ void argv_free(char **argv);
int strtobool(const char *s, bool *res);
-#define strscpy strcpy
+ssize_t strscpy(char *dest, const char *src, size_t count);
/*
* glibc based builds needs the extern while uClibc doesn't.
--
2.54.0
next reply other threads:[~2026-05-06 16:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 16:34 Lucas Poupeau [this message]
2026-05-06 16:47 ` [PATCH] tools: include: add proper strscpy() declaration Maxwell Doose
2026-05-07 2:42 ` Wei Yang
2026-05-07 3:11 ` Maxwell Doose
-- strict thread matches above, loose matches on Subject: below --
2026-05-04 21:23 Lucas Poupeau
2026-05-04 21:38 ` Maxwell Doose
2026-05-04 21:47 ` Maxwell Doose
2026-05-06 4:21 ` Maxwell Doose
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=20260506163452.53067-1-lucasp.linux@gmail.com \
--to=lucasp.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m32285159@gmail.com \
--cc=richard.weiyang@gmail.com \
/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