Re: Linux 5.15

From: Guenter Roeck
Date: Mon Nov 01 2021 - 21:18:24 EST


On 11/1/21 1:13 AM, Geert Uytterhoeven wrote:
Hi Günter.

On Mon, Nov 1, 2021 at 1:28 AM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
On Sun, Oct 31, 2021 at 02:09:07PM -0700, Linus Torvalds wrote:
Building m68k:allmodconfig ... failed
--------------
Error log:
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:63,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:6,
from include/linux/slab.h:15,
from drivers/nvme/target/discovery.c:7:
In function 'memcpy_and_pad',
inlined from 'nvmet_execute_disc_identify' at drivers/nvme/target/discovery.c:268:2:
arch/m68k/include/asm/string.h:72:25: error: '__builtin_memcpy' reading 8 bytes from a region of size 7

Another instance of the same problem:

In function 'memcpy_and_pad',
inlined from 'nvmet_execute_identify_ctrl' at drivers/nvme/target/admin-cmd.c:372:2:
arch/m68k/include/asm/string.h:72:25: error: '__builtin_memcpy' reading 8 bytes from a region of size 7

This is seen with gcc 11.1 and 11.2. gcc 10.3 builds fine.
The code in question is

memcpy_and_pad(id->fr, sizeof(id->fr),
UTS_RELEASE, strlen(UTS_RELEASE), ' ');

and UTS_RELEASE is "5.15.0". I have no idea what might be wrong with the code.

Me neither. That warning (now error) has been seen with all point
releases (i.e. strlen(UTS_RELEASE) < 8) since v5.0.


Ah yes, I can see that now. I guess I didn't notice earlier because it was
only reported as warning.

Does anyone have an idea ?

We had a discussion in
https://lore.kernel.org/all/CAMuHMdX365qmWiii=gQLADpW49EMkdDrVJDPWNBpAZuZM0WQFQ@xxxxxxxxxxxxxx
but without any definitive conclusion.

Do I need to revert to gcc 10.3 for m68k ?

I'm not sure that might help, as the issue has been seen with
e.g. 8.1.0 and 8.2.0, too, with a slightly different message:
warning: ‘__builtin_memcpy’ forming offset 8 is out of the bounds [0,
7] [-Warray-bounds]

Any suggestions? Thanks!


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 ?

Thanks,
Guenter