Skip to content

Commit d3b3c63

Browse files
committed
parisc: Fix crash with nr_cpus=1 option
John David Anglin reported that giving "nr_cpus=1" on the command line causes a crash, while "maxcpus=1" works. Reported-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de> Cc: stable@vger.kernel.org # v5.18+
1 parent ce9ecca commit d3b3c63

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/parisc/kernel/smp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,9 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
440440
if (cpu_online(cpu))
441441
return 0;
442442

443-
if (num_online_cpus() < setup_max_cpus && smp_boot_one_cpu(cpu, tidle))
443+
if (num_online_cpus() < nr_cpu_ids &&
444+
num_online_cpus() < setup_max_cpus &&
445+
smp_boot_one_cpu(cpu, tidle))
444446
return -EIO;
445447

446448
return cpu_online(cpu) ? 0 : -EIO;

0 commit comments

Comments
 (0)