From: David Laight <david.laight.linux@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Min-Hsun Chang <chmh0624@gmail.com>,
arnd@arndb.de, msalter@redhat.com, linux-arch@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] asm-generic: replace ________addr with __UNIQUE_ID(addr)
Date: Sun, 26 Apr 2026 22:43:33 +0100 [thread overview]
Message-ID: <20260426224333.5916c960@pumpkin> (raw)
In-Reply-To: <20260426110932.786047b4338843e0a91abaa9@linux-foundation.org>
On Sun, 26 Apr 2026 11:09:32 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Sun, 26 Apr 2026 18:34:20 +0100 David Laight <david.laight.linux@gmail.com> wrote:
>
> > > > True - don't look at what strlcpy() can generate.
> > > > The inline code should just get the constants from the compiler and
> > > > then call the appropriate function.
> > >
> > > I can't actually find an in-kernel strlcpy()?
> >
> > That is because I meant strscpy() :-)
> >
> > In particular https://elixir.bootlin.com/linux/v7.0/source/include/linux/fortify-string.h#L275
> > Particularly once it gets as far as calling strnlen().
>
> Oh geeze, why did we do that. This is the kernel - string functions
> aren't fastpath! Someone please move all that gunk into lib/string.c!
It might be worth selecting memcpy() for fixed length copies that fit.
Especially since that can get inlined to something smaller than the call.
> We'll still need some macro if we are to retain the (imo silly)
> omit-arg3-if-its-an-array trick.
Try: strscpy(tgt, src, len, spare_argument)
I'm pretty sure it compiles fine.
David
prev parent reply other threads:[~2026-04-26 21:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-07 9:21 [PATCH] asm-generic: replace ________addr with __UNIQUE_ID(addr) Min-Hsun Chang
2026-03-22 13:20 ` Min-Hsun Chang
2026-03-22 14:40 ` David Laight
2026-04-25 20:57 ` Andrew Morton
2026-04-25 22:01 ` David Laight
2026-04-25 22:12 ` Andrew Morton
2026-04-26 10:49 ` David Laight
2026-04-26 11:09 ` Andrew Morton
2026-04-26 17:34 ` David Laight
2026-04-26 18:09 ` Andrew Morton
2026-04-26 21:43 ` David Laight [this message]
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=20260426224333.5916c960@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=chmh0624@gmail.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=msalter@redhat.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