summaryrefslogtreecommitdiff
path: root/arch/s390/numa
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2016-12-02 13:16:02 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-12-07 07:22:41 +0100
commit307b3114eff6ba981c8eddbce327b4a82158bfe3 (patch)
treea167d837d59f4197575f8b6bf84decbd3d97aafa /arch/s390/numa
parent11a247e376669323b0d9f56fbdb5c163c6310112 (diff)
s390/numa: always use logical cpu and core ids
The toptree algorithm uses the physical core ids to create a mapping between cores and nodes (to_node_id array within emu_cores structure). The core ids are used as an index into an array which size depends on CONFIG_NR_CPUS. If the physical core ids are larger, this will result in out-of-bounds write accesses. Generate logical core ids instead to avoid this. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/numa')
-rw-r--r--arch/s390/numa/mode_emu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/s390/numa/mode_emu.c b/arch/s390/numa/mode_emu.c
index 37e0bb835516..b83109328fec 100644
--- a/arch/s390/numa/mode_emu.c
+++ b/arch/s390/numa/mode_emu.c
@@ -360,7 +360,7 @@ static struct toptree *toptree_from_topology(void)
drawer = toptree_get_child(node, top->drawer_id);
book = toptree_get_child(drawer, top->book_id);
mc = toptree_get_child(book, top->socket_id);
- core = toptree_get_child(mc, top->core_id);
+ core = toptree_get_child(mc, smp_get_base_cpu(cpu));
if (!drawer || !book || !mc || !core)
panic("NUMA emulation could not allocate memory");
cpumask_set_cpu(cpu, &core->mask);