Re: [PATCH] HID: hyperv: avoid struct memcpy overrun warning

From: Arnd Bergmann
Date: Mon Jul 17 2023 - 06:44:28 EST


On Mon, Jul 17, 2023, at 11:36, Andy Shevchenko wrote:
> On Wed, Jul 05, 2023 at 04:02:24PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>
>> A previous patch addressed the fortified memcpy warning for most
>> builds, but I still see this one with gcc-9:
>
> JFYI: as of today I have run Linux Next with `make W=1 allmodconfig` on x86_64
> and it seems there are still tons of similar issues which break the build.

It's a bit more complex:

- yes, there are lots of warnings for memcpy() read overflow when you
build allmodconfig kernels with W=1. I have patches for all of these and
plan to submit them over time.

- This particular one is a memcpy /write/ overflow, i.e. the
destination type overflows with the length according to gcc's
understanding of the structures. This warning is enabled even
without W=1, though it may only show up in certain configurations
or compiler versions.

Arnd