From: Ian Campbell Date: Tue, 3 Jul 2012 09:52:33 +0000 (+0100) Subject: xen: add assertion in default_vcpu0_location to protect against broken masks X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~8216 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5dd2cbfba50238b262b3b6712cff6ce16d8fb95d;p=xen.git 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 Acked-by: Jan Beulich Acked-by: Keir Fraser Committed-by: Ian Campbell --- 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) )