Declare online_cpus so that it is properly sized to have MAX_TEST_CPUS bits. Currently, online_cpus is hardcoded to a u64, i.e. changing MAX_TEST_CPUS to be greater than 64 will result in a variety of out of bounds accesses. Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> --- lib/x86/smp.c | 2 -- x86/cstart.S | 2 +- x86/cstart64.S | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/x86/smp.c b/lib/x86/smp.c index 30bd1a0..7b1e0e1 100644 --- a/lib/x86/smp.c +++ b/lib/x86/smp.c @@ -113,8 +113,6 @@ int cpus_active(void) return atomic_read(&active_cpus); } -extern unsigned long long online_cpus; - void smp_init(void) { int i; diff --git a/x86/cstart.S b/x86/cstart.S index 575101b..76f6ba5 100644 --- a/x86/cstart.S +++ b/x86/cstart.S @@ -208,7 +208,7 @@ smp_init_done: ret online_cpus: - .quad 0 + .fill max_cpus / 8, 1, 0 cpu_online_count: .word 1 diff --git a/x86/cstart64.S b/x86/cstart64.S index d4e4652..89ad9f4 100644 --- a/x86/cstart64.S +++ b/x86/cstart64.S @@ -282,7 +282,7 @@ idt_descr: .quad boot_idt online_cpus: - .quad 0 + .fill max_cpus / 8, 1, 0 load_tss: lidtq idt_descr -- 2.22.0