aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/domctl.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2012-07-03 10:52:33 +0100
committerIan Campbell <ian.campbell@citrix.com>2012-07-03 10:52:33 +0100
commit5dd2cbfba50238b262b3b6712cff6ce16d8fb95d (patch)
tree0bba430f8427e3de68b8f15f8349e76f9e7d761b /xen/common/domctl.c
parent52c18e15d53f95861591c973413c020528c681bb (diff)
downloadxen-5dd2cbfba50238b262b3b6712cff6ce16d8fb95d.tar.gz
xen-5dd2cbfba50238b262b3b6712cff6ce16d8fb95d.tar.bz2
xen-5dd2cbfba50238b262b3b6712cff6ce16d8fb95d.zip
xen: add assertion in default_vcpu0_location to protect against broken masks
When setting up the cpu sibling/etc masks on ARM I accidentally and incorrectly omitted a CPU from it's own sibling mask which caused this function to return an invalid cpu number which caused errors later when we tried to access per_cpu data for that invalid cpu. Add an assert to catch this in the future. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'xen/common/domctl.c')
-rw-r--r--xen/common/domctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 9f1a9ada8c..7ca6b08fa5 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -192,6 +192,7 @@ static unsigned int default_vcpu0_location(cpumask_t *online)
cpu = cpumask_first(&cpu_exclude_map);
if ( cpumask_weight(&cpu_exclude_map) > 1 )
cpu = cpumask_next(cpu, &cpu_exclude_map);
+ ASSERT(cpu < nr_cpu_ids);
for_each_cpu(i, online)
{
if ( cpumask_test_cpu(i, &cpu_exclude_map) )