Re: Linux 5.15

Linus Torvalds
2021-11-02T01:45:01Z

On Mon, Nov 1, 2021 at 6:18 PM Guenter Roeck <linux@roeck-us.net> 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.

Linus