diff options
author | Peter Zijlstra <peterz@infradead.org> | 2019-09-03 09:53:52 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-09-05 13:03:04 +0200 |
commit | bc04a049f058a472695aa22905d57e2b1f4c77d9 (patch) | |
tree | d743d5d2a6cf490a3d7ff824e925fdb02ff0987e /arch/x86/mm | |
parent | x86/mm: Remove the unused set_memory_wt() function (diff) | |
download | linux-bc04a049f058a472695aa22905d57e2b1f4c77d9.tar.xz linux-bc04a049f058a472695aa22905d57e2b1f4c77d9.zip |
x86/mm: Fix cpumask_of_node() error condition
When CONFIG_DEBUG_PER_CPU_MAPS=y we validate that the @node argument of
cpumask_of_node() is a valid node_id. It however forgets to check for
negative numbers. Fix this by explicitly casting to unsigned int.
(unsigned)node >= nr_node_ids
verifies: 0 <= node < nr_node_ids
Also ammend the error message to match the condition.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Yunsheng Lin <linyunsheng@huawei.com>
Link: https://lkml.kernel.org/r/20190903075352.GY2369@hirez.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/numa.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index e6dad600614c..4123100e0eaf 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -861,9 +861,9 @@ 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", + "cpumask_of_node(%d): (unsigned)node >= nr_node_ids(%u)\n", node, nr_node_ids); dump_stack(); return cpu_none_mask; |