sched/topology: Fix off by one bug
authorPeter Zijlstra <peterz@infradead.org>
Fri, 2 Nov 2018 13:22:25 +0000 (14:22 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 3 Nov 2018 23:40:03 +0000 (00:40 +0100)
With the addition of the NUMA identity level, we increased @level by
one and will run off the end of the array in the distance sort loop.

Fixed: 051f3ca02e46 ("sched/topology: Introduce NUMA identity node sched domain")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/topology.c

index 9d74371e4aad86a436c549045be08c2a1ed30853..8d7f15ba59163c3a496f0284c2473a0575d57958 100644 (file)
@@ -1337,7 +1337,7 @@ void sched_init_numa(void)
        int level = 0;
        int i, j, k;
 
-       sched_domains_numa_distance = kzalloc(sizeof(int) * nr_node_ids, GFP_KERNEL);
+       sched_domains_numa_distance = kzalloc(sizeof(int) * (nr_node_ids + 1), GFP_KERNEL);
        if (!sched_domains_numa_distance)
                return;