From: Julien Grall Subject: [PATCH] xen/arm: arch_domain_create: don't return 0 when alloc_xenheap_pages has failed Date: Sun, 8 Dec 2013 02:32:32 +0000 Message-ID: <1386469952-21744-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VpUAh-0001xB-Iv for xen-devel@lists.xenproject.org; Sun, 08 Dec 2013 02:32:39 +0000 Received: by mail-ea0-f175.google.com with SMTP id z10so935934ead.34 for ; Sat, 07 Dec 2013 18:32:38 -0800 (PST) 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.xenproject.org Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com, patches@linaro.org List-Id: xen-devel@lists.xenproject.org The previous call before alloc_xenheap_pages reset rc to 0 if it success. If the latter fails, arch_domain_create will return 0 and Xen will consider the domain as valid. Move rc initialization later. Signed-off-by: Julien Grall --- xen/arch/arm/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 52d2403..67c65c3 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -501,10 +501,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags) if ( is_idle_domain(d) ) return 0; - rc = -ENOMEM; if ( (rc = p2m_init(d)) != 0 ) goto fail; + rc = -ENOMEM; if ( (d->shared_info = alloc_xenheap_pages(0, 0)) == NULL ) goto fail; -- 1.7.10.4