Module Name:    src
Committed By:   bouyer
Date:           Sat Feb 25 18:57:51 UTC 2012

Modified Files:
        src/sys/arch/xen/x86: cpu.c

Log Message:
The code assumes that ci_index is also the Xen's cpunum, and that
cpunum is less than XEN_LEGACY_MAX_VCPUS. KASSERT both.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/xen/x86/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/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.88 src/sys/arch/xen/x86/cpu.c:1.89
--- src/sys/arch/xen/x86/cpu.c:1.88	Fri Feb 24 11:43:06 2012
+++ src/sys/arch/xen/x86/cpu.c	Sat Feb 25 18:57:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.88 2012/02/24 11:43:06 bouyer Exp $	*/
+/*	$NetBSD: cpu.c,v 1.89 2012/02/25 18:57:50 bouyer Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.88 2012/02/24 11:43:06 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.89 2012/02/25 18:57:50 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -409,6 +409,7 @@ cpu_attach_common(device_t parent, devic
 	ci->ci_cpuid = cpunum;
 
 	KASSERT(HYPERVISOR_shared_info != NULL);
+	KASSERT(cpunum < XEN_LEGACY_MAX_VCPUS);
 	ci->ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[cpunum];
 
 	KASSERT(ci->ci_func == 0);
@@ -434,6 +435,7 @@ cpu_attach_common(device_t parent, devic
 		KASSERT(ci->ci_data.cpu_idlelwp != NULL);
 	}
 
+	KASSERT(ci->ci_cpuid == ci->ci_index);
 	ci->ci_cpumask = (1 << cpu_index(ci));
 	pmap_reference(pmap_kernel());
 	ci->ci_pmap = pmap_kernel();

Reply via email to