Re: [GIT PULL] EDAC fix for 5.17

From: Linus Torvalds
Date: Sun Feb 20 2022 - 15:13:03 EST


On Sun, Feb 20, 2022 at 3:50 AM Borislav Petkov <bp@xxxxxxx> wrote:
>
> please pull a fix for a long-standing, hard-to-catch issue in the EDAC
> weird struct allocation code, for 5.17.

Heh. Yeah, that was subtly buggy.

Side note: the comment says that it will align to at least as much as
the compiler would do, but then it does something different, eg

if (size > sizeof(long))
align = sizeof(long long);
...

and it might make sense to use "__alignof__()" instead of "sizeof()"
just to make the code match the comment.

For example, on 32-bit x86, "sizeof(long long)" is 8, but
"__alignof__(long long)" is only 4.

And then we have m68k..

Or maybe the comment should be fixed instead, and talk about "natural
alignment" rather than "compiler alignment".

Linus