Re: [v5 PATCH 5/8] RISC-V: Compare cpuid with NR_CPUS before mapping.

From: Christopher Lameter
Date: Thu Feb 14 2019 - 12:59:13 EST


On Wed, 13 Feb 2019, Atish Patra wrote:

> --- a/arch/riscv/kernel/smpboot.c
> +++ b/arch/riscv/kernel/smpboot.c
> @@ -66,6 +66,11 @@ void __init setup_smp(void)
> found_boot_cpu = 1;
> continue;
> }
> + if (cpuid >= NR_CPUS) {

Use nr_cpu_ids instead? Its initialized to NR_CPUS but can be restricted
if we can determine on boot how many processor we truly have.