Module Name: src
Committed By: ad
Date: Thu May 28 20:29:18 UTC 2020
Modified Files:
src/sys/kern: kern_cpu.c
Log Message:
At least panic with a useful message if there are too many CPUs.
To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/kern/kern_cpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.90 src/sys/kern/kern_cpu.c:1.91
--- src/sys/kern/kern_cpu.c:1.90 Sat May 23 23:42:43 2020
+++ src/sys/kern/kern_cpu.c Thu May 28 20:29:18 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_cpu.c,v 1.90 2020/05/23 23:42:43 ad Exp $ */
+/* $NetBSD: kern_cpu.c,v 1.91 2020/05/28 20:29:18 ad Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.90 2020/05/23 23:42:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.91 2020/05/28 20:29:18 ad Exp $");
#ifdef _KERNEL_OPT
#include "opt_cpu_ucode.h"
@@ -130,7 +130,8 @@ mi_cpu_attach(struct cpu_info *ci)
KASSERT(maxcpus > 0);
- ci->ci_index = ncpu;
+ if ((ci->ci_index = ncpu) >= maxcpus)
+ panic("Too many CPUs. Increase MAXCPUS?");
kcpuset_set(kcpuset_attached, cpu_index(ci));
/*