Re: [PATCH] workqueue: validate cpumask_first() result in llc_populate_cpu_shard_id()
From: Tejun Heo
Date: Fri Apr 10 2026 - 13:36:49 EST
Hello,
On Fri, Apr 10, 2026 at 03:42:00AM -0700, Breno Leitao wrote:
> @@ -8318,7 +8319,17 @@ static void __init llc_populate_cpu_shard_id(const struct cpumask *pod_cpus,
> * The siblings' shard MUST be the same as the leader.
> * never split threads in the same core.
> */
> - cpu_shard_id[c] = cpu_shard_id[cpumask_first(sibling_cpus)];
> + leader = cpumask_first(sibling_cpus);
> +
> + /*
> + * sibling_cpus cannot be empty here since 'c'
> + * is always set in it. This check silences a
> + * compiler warning about using the unchecked
> + * cpumask_first() result as an array index.
> + */
Can you add more details on the warning and update the patch desc
accordingly? This only triggers on UP configs, right?
Thanks.
--
tejun