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>
This commit is contained in:
Heiko Carstens
2016-12-02 13:16:02 +01:00
committed by Martin Schwidefsky
부모 11a247e376
커밋 307b3114ef
2개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제

파일 보기

@@ -69,6 +69,12 @@ static inline void smp_stop_cpu(void)
}
}
/* Return thread 0 CPU number as base CPU */
static inline int smp_get_base_cpu(int cpu)
{
return cpu - (cpu % (smp_cpu_mtid + 1));
}
#ifdef CONFIG_HOTPLUG_CPU
extern int smp_rescan_cpus(void);
extern void __noreturn cpu_die(void);