[PATCH v2 2/9] x86: numa: check the node id consistently for x86
Ingo Molnar
mingo at kernel.org
Tue Sep 3 04:17:31 AEST 2019
* Peter Zijlstra <peterz at infradead.org> wrote:
> Also note that the CONFIG_DEBUG_PER_CPU_MAPS version of
> cpumask_of_node() already does this (although it wants the below fix).
>
> ---
> diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
> index e6dad600614c..5f49c10201c7 100644
> --- a/arch/x86/mm/numa.c
> +++ b/arch/x86/mm/numa.c
> @@ -861,7 +861,7 @@ void numa_remove_cpu(int cpu)
> */
> const struct cpumask *cpumask_of_node(int node)
> {
> - if (node >= nr_node_ids) {
> + if ((unsigned)node >= nr_node_ids) {
> printk(KERN_WARNING
> "cpumask_of_node(%d): node > nr_node_ids(%u)\n",
> node, nr_node_ids);
Nitpicking: please also fix the kernel message to say ">=".
With that:
Acked-by: Ingo Molnar <mingo at kernel.org>
Note that:
- arch/arm64/mm/numa.c copied the same sign bug (or unrobustness if we
don't want to call it a bug).
- Kudos to the mm/memcontrol.c and kernel/bpf/syscall.c teams for not
copying that bug. Booo for none of them fixing the buggy pattern
elsewhere in the kernel ;-)
Thanks,
Ingo
More information about the Linuxppc-dev
mailing list