Re: Linux 5.15
From: Guenter Roeck
Date: Mon Nov 01 2021 - 23:19:42 EST
On Mon, Nov 01, 2021 at 06:44:39PM -0700, Linus Torvalds wrote:
> On Mon, Nov 1, 2021 at 6:18 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
> >
> > Replacing "strlen(UTS_RELEASE)" with "sizeof(UTS_RELEASE) - 1" seems to do
> > the trick, at least with gcc 11.2 and v5.15. I just wonder if that would be
> > acceptable. Any idea ?
>
> Looks sane to me.
>
> I don't understand why gcc complains about that thing in the first
> place, much less why it only happens on m68k, but whatever...
>
> The other - and perhaps better - option would be to just uninline
> memcpy_and_pad() entirely, move it to lib/string.c, and only have the
> declaration in <linux/string.h>.
>
> Because the only reason to have it as an inline function is when the
> compiler can statically optimize a call site: but it's really not a
> performance-critical function to begin with, and clearly the compiler
> instead just *breaks* rather than optimize that call-site.
>
Excellent suggestion. I'll submit a patch to do just that.
Thanks,
Guenter