Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern At least panic with a useful message if there are t...



details:   https://anonhg.NetBSD.org/src/rev/e9b514f5ee7c
branches:  trunk
changeset: 933706:e9b514f5ee7c
user:      ad <ad%NetBSD.org@localhost>
date:      Thu May 28 20:29:18 2020 +0000

description:
At least panic with a useful message if there are too many CPUs.

diffstat:

 sys/kern/kern_cpu.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r fe7408cf8054 -r e9b514f5ee7c sys/kern/kern_cpu.c
--- a/sys/kern/kern_cpu.c       Thu May 28 20:27:41 2020 +0000
+++ b/sys/kern/kern_cpu.c       Thu May 28 20:29:18 2020 +0000
@@ -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 @@
 
        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));
 
        /*



Home | Main Index | Thread Index | Old Index