Re: [GIT PULL] hardening fixes for v6.6-rc3
From: Linus Torvalds
Date: Sat Sep 23 2023 - 14:02:47 EST
On Sat, 23 Sept 2023 at 09:53, Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
>
> This doesn't work with g++ :-(
Whee. So the compiler seems to literally test "is it at offset 0", and
refuses to do flex arrays there.
Oh well. So flex arrays are just not usable on C++, because the
language tries to "protect" us from outselves. What else is new. I
suspect it's the same broken reason that empty structs aren't
zero-sized - stop the user from being clever.
I had hoped that the C++ people had learnt from their mistakes, but no.
Happily we don't have to deal with that crud for kernel code. I don't
like the #ifdef, but if it's needed...
Linus