Re: [GIT PULL] percpu fix for v5.9-rc6

From: Linus Torvalds
Date: Fri Sep 18 2020 - 16:16:37 EST


On Fri, Sep 18, 2020 at 1:02 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> I suppose it's not really necessary, we could do offsetof here, right?

Yup, that would make a lot more sense.

But right now, the sizeof() obviously silently works.

As do a number of other fairly nonsensical things, like assigning a struct etc.

And yes, I realize we may well do that too. But I think that's a
dangerous pattern too, ie doing

*a = *b;

silently works, and copies everything but the final array.

And yes - none of this is _worse_ than using zero-sized arrays, but
the point is that it isn't better either.

Linus