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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 17, 2020 at 1:45 PM Dennis Zhou <dennis@xxxxxxxxxx> 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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux