Re: [PATCH] asm-generic: replace ________addr with __UNIQUE_ID(addr)
From: David Laight
Date: Sun Apr 26 2026 - 17:43:53 EST
On Sun, 26 Apr 2026 11:09:32 -0700
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, 26 Apr 2026 18:34:20 +0100 David Laight <david.laight.linux@xxxxxxxxx> 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