From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH 21/21] xen: add assertion in default_vcpu0_location to protect against broken masks Date: Thu, 28 Jun 2012 14:48:09 +0000 Message-ID: <1340894890-4369-21-git-send-email-ian.campbell@citrix.com> References: <1340894870.10942.63.camel@zakaz.uk.xensource.com> <1340894890-4369-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1340894890-4369-1-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ian Campbell List-Id: xen-devel@lists.xenproject.org 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 --- xen/common/domctl.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 9f1a9ad..7ca6b08 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) ) -- 1.7.9.1