Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/include Don't attempt to dereference cpu_infos...



details:   https://anonhg.NetBSD.org/src/rev/69db77029d50
branches:  trunk
changeset: 829230:69db77029d50
user:      maya <maya%NetBSD.org@localhost>
date:      Mon Jan 22 23:20:26 2018 +0000

description:
Don't attempt to dereference cpu_infos if ncpus == 0.
Instead use the already initialized cpu_info_store.

(Also, now we assume all ncpus have cpu_infos initialized. seems to work.)

fixes PR port-mips/52940: ERLITE multiprocessor hangs early

diffstat:

 sys/arch/mips/include/cpu.h |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 684e7be7fa37 -r 69db77029d50 sys/arch/mips/include/cpu.h
--- a/sys/arch/mips/include/cpu.h       Mon Jan 22 22:36:11 2018 +0000
+++ b/sys/arch/mips/include/cpu.h       Mon Jan 22 23:20:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.122 2017/12/16 00:37:52 mrg Exp $    */
+/*     $NetBSD: cpu.h,v 1.123 2018/01/22 23:20:26 maya Exp $   */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -160,7 +160,9 @@
 #ifdef MULTIPROCESSOR
 #define        CPU_INFO_ITERATOR               int
 #define        CPU_INFO_FOREACH(cii, ci)       \
-    cii = 0, ci = cpu_infos[0]; cii < (ncpu ? ncpu : 1) && (ci = cpu_infos[cii]) != NULL; cii++
+    cii = 0, ci = (ncpu ? cpu_infos[0] : &cpu_info_store); \
+    cii < (ncpu ? ncpu : 1); \
+    ++cii
 #else
 #define        CPU_INFO_ITERATOR               int __unused
 #define        CPU_INFO_FOREACH(cii, ci)       \



Home | Main Index | Thread Index | Old Index