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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <f9227920-a1a7-4f12-92d3-225e8753b32a@bytedance.com>
Date: Fri, 06 Feb 2026 19:26:09 +0800
From: "wuqiang.matt" <wuqiang.matt@...edance.com>
To: "zhouwenhao" <zhouwenhao7600@...il.com>, 
	"Masami Hiramatsu" <mhiramat@...nel.org>
Cc: <linux-kernel@...r.kernel.org>, <linux-trace-kernel@...r.kernel.org>, 
	"Andrew Morton" <akpm@...ux-foundation.org>
Subject: Re: [PATCH] objpool: fix the overestimation of object pooling metadata size

On 2026/2/2 21:28, zhouwenhao wrote:
> objpool uses struct objpool_head to store metadata information, and its
> cpu_slots member points to an array of pointers that store the addresses of
> the percpu ring arrays. However, the memory size allocated during the
> initialization of cpu_slots is nr_cpu_ids * sizeof(struct objpool_slot). On
> a 64-bit machine, the size of struct objpool_slot is 16 bytes, which is
> twice the size of the actual pointer required, and the extra memory is
> never be used, resulting in a waste of memory. Therefore, the memory size
> required for cpu_slots needs to be corrected.
> 
> Fixes: b4edb8d2d464 ("lib: objpool added: ring-array based lockless MPMC")
> 
> Signed-off-by: zhouwenhao <zhouwenhao7600@...il.com>
> ---
>   lib/objpool.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/objpool.c b/lib/objpool.c
> index b998b720c732..d98fadf1de16 100644
> --- a/lib/objpool.c
> +++ b/lib/objpool.c
> @@ -142,7 +142,7 @@ int objpool_init(struct objpool_head *pool, int nr_objs, int object_size,
>           pool->gfp = gfp & ~__GFP_ZERO;
>           pool->context = context;
>           pool->release = release;
> -        slot_size = nr_cpu_ids * sizeof(struct objpool_slot);
> +        slot_size = nr_cpu_ids * sizeof(struct objpool_slot *);
>           pool->cpu_slots = kzalloc(slot_size, pool->gfp);
>           if (!pool->cpu_slots)
>                   return -ENOMEM;

Good catch. It should be "struct objpool_slot *".

Masami, could you please review this fix ? Thank you.

Regards,
Matt Wu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ