Messages in this thread | | | Date | Mon, 13 Jun 2022 11:14:04 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH] lib/genalloc: Set chunk size to real size which gen_pool managed. |
| |
On Sun, 12 Jun 2022 18:59:37 +0800 wuchi <wuchi.zero@gmail.com> wrote:
> The demand size (chunk->avail > size > round_down(chunk->avail)) will > lead to meaningless algo calls in gen_pool_alloc_algo_owner without the > patch, alse move the follow code: > size = nbits << order > out of read-side critical section. >
Nobody has seriously worked on this code in a long time :(
Please expand more on the flaw. What are "algo calls"? Why are they meaningless, etc? What are the runtime effects of this error?
> --- a/lib/genalloc.c > +++ b/lib/genalloc.c > @@ -193,6 +193,7 @@ int gen_pool_add_owner(struct gen_pool *pool, unsigned long virt, phys_addr_t ph > if (unlikely(chunk == NULL)) > return -ENOMEM; > > + size = nbits << pool->min_alloc_order;
If we're going to do this then gen_pool_add_owner() no longer needs its `size' argument.
| |