[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whXpv0KJvpL153dhUaRgSjzT8H4dD85hRw-fAwXvXnKAA@mail.gmail.com>
Date: Thu, 17 Sep 2020 18:05:13 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Dennis Zhou <dennis@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Tejun Heo <tj@...nel.org>, Christoph Lameter <cl@...ux.com>,
Linux-MM <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [GIT PULL] percpu fix for v5.9-rc6
On Thu, Sep 17, 2020 at 1:45 PM Dennis Zhou <dennis@...nel.org> wrote:
>
>
> diff --git a/mm/percpu.c b/mm/percpu.c
> index f4709629e6de..1ed1a349eab8 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -1316,7 +1316,7 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr,
>
> /* allocate chunk */
> alloc_size = sizeof(struct pcpu_chunk) +
> - BITS_TO_LONGS(region_size >> PAGE_SHIFT);
> + BITS_TO_LONGS(region_size >> PAGE_SHIFT) * sizeof(unsigned long);
Hmm.
Wouldn't this be cleaner as
alloc_size =struct_size(chunk, populated,
BITS_TO_LONGS(region_size >> PAGE_SHIFT) );
and looking at this, I realize that I thought we enabled warnings for
'sizeof()' of flexible array structures to avoid these kinds of
mistakes, but that must clearly have happened only in a dream of mine.
Anyway, pulled.
Linus
Powered by blists - more mailing lists