lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+tQmHDTGNY_mVF82smqka5AJJrHcKG6og2zfNgn=-dJEgaNHQ@mail.gmail.com>
Date:   Wed, 15 Jun 2022 20:41:34 +0800
From:   chi wu <wuchi.zero@...il.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     alexs@...nel.org, sjhuang@...vatar.ai, sfr@...b.auug.org.au,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib/genalloc: Set chunk size to real size which gen_pool managed.

Andrew Morton <akpm@...ux-foundation.org> 于2022年6月15日周三 01:53写道:
>
> On Tue, 14 Jun 2022 13:20:08 +0800 chi wu <wuchi.zero@...il.com> wrote:
>
> > > If we're going to do this then gen_pool_add_owner() no longer needs its
> > > `size' argument.
> > >
> > >
> > Sorry, What point did I misunderstand?
>
> I mean we can now do this:
>
> --- a/lib/genalloc.c~lib-genalloc-set-chunk-size-to-real-size-which-gen_pool-managed-fix
> +++ a/lib/genalloc.c
> @@ -181,13 +181,14 @@ EXPORT_SYMBOL(gen_pool_create);
>   *
>   * Returns 0 on success or a -ve errno on failure.
>   */
> -int gen_pool_add_owner(struct gen_pool *pool, unsigned long virt, phys_addr_t phys,
> -                size_t size, int nid, void *owner)
> +int gen_pool_add_owner(struct gen_pool *pool, unsigned long virt,
> +                      phys_addr_t phys, int nid, void *owner)
>  {
>         struct gen_pool_chunk *chunk;
>         unsigned long nbits = size >> pool->min_alloc_order;    [1]

The arg @size is in bytes of the memory chunk to add to pool,  we
really need that, [1] here we
get nbits by size. [2]  later we will alloc bitmap by nbits...   If we
remove the arg @size, we will
have no way to get the size of memory which we will manage.

>         unsigned long nbytes = sizeof(struct gen_pool_chunk) +
>                                 BITS_TO_LONGS(nbits) * sizeof(long);      [1]
> +       size_t size;
>
>         chunk = vzalloc_node(nbytes, nid);
>         if (unlikely(chunk == NULL))
> _
>

Thanks for Andrew's time

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ