From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: [PATCH v3 06/11] arm: handle dom0_max_vcpus=0 case properly Date: Fri, 2 Mar 2012 14:27:32 +0000 Message-ID: <1330698457-8622-6-git-send-email-stefano.stabellini@eu.citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: 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.xensource.com Cc: Tim.Deegan@citrix.com, Stefano.Stabellini@eu.citrix.com, Ian Campbell , david.vrabel@citrix.com List-Id: xen-devel@lists.xenproject.org From: Ian Campbell Also use xzalloc_array. Signed-off-by: Ian Campbell Acked-by: Stefano Stabellini --- xen/arch/arm/domain_build.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index cbbc0b9..ef52d1d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -14,13 +14,14 @@ integer_param("dom0_max_vcpus", opt_dom0_max_vcpus); struct vcpu *__init alloc_dom0_vcpu0(void) { - dom0->vcpu = xmalloc_array(struct vcpu *, opt_dom0_max_vcpus); + if ( opt_dom0_max_vcpus == 0 ) + opt_dom0_max_vcpus = num_online_cpus(); + if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS ) + opt_dom0_max_vcpus = MAX_VIRT_CPUS; + + dom0->vcpu = xzalloc_array(struct vcpu *, opt_dom0_max_vcpus); if ( !dom0->vcpu ) - { - printk("failed to alloc dom0->vccpu\n"); return NULL; - } - memset(dom0->vcpu, 0, opt_dom0_max_vcpus * sizeof(*dom0->vcpu)); dom0->max_vcpus = opt_dom0_max_vcpus; return alloc_vcpu(dom0, 0, 0); -- 1.7.2.5