Re: [PATCH 1/5] lib/group_cpus: Let group_cpu_evenly() return the number of initialized masks
From: Chaitanya Kulkarni
Date: Wed Jun 25 2025 - 00:37:30 EST
On 6/17/25 06:43, Daniel Wagner wrote:
> group_cpu_evenly() might have allocated less groups then requested:
>
> group_cpu_evenly()
> __group_cpus_evenly()
> alloc_nodes_groups()
> # allocated total groups may be less than numgrps when
> # active total CPU number is less then numgrps
>
> In this case, the caller will do an out of bound access because the
> caller assumes the masks returned has numgrps.
>
> Return the number of groups created so the caller can limit the access
> range accordingly.
>
> Acked-by: Thomas Gleixner<tglx@xxxxxxxxxxxxx>
> Reviewed-by: Hannes Reinecke<hare@xxxxxxx>
> Reviewed-by: Ming Lei<ming.lei@xxxxxxxxxx>
> Signed-off-by: Daniel Wagner<wagi@xxxxxxxxxx>
> ---
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>
-ck