From patchwork Mon Feb 18 10:03:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 158580 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2299975jaa; Mon, 18 Feb 2019 02:06:05 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib83stFxVSGJ002tmeNxVSEUlSnECSkwWm5TFnmaJxy7NLxAsoJLFTbJjccRg4ut2zBeEHj X-Received: by 2002:a25:b06:: with SMTP id 6mr18500452ybl.355.1550484365581; Mon, 18 Feb 2019 02:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550484365; cv=none; d=google.com; s=arc-20160816; b=KUUr2UzAPNqs6WzdCravopxt+z3KNQ67NgwqJ6nGqtzWDoaSqjS5CswROpbth7JNMe D+eprgw1UhFoPH5wjseRsXMhKmEF4fusF2kvtGK9t86WUvmAe01pA6X4uXaN4bsia5HS arbR/lshm8OCs6M+hybPYDXs7ker7gxMur39h1PAe7OwFJx2yyXM/fwPBKzae60Zp9uw Z3Gceiv4XXdJHS6D78TTtBUVNidnErxqCB9ELLSvuWRpuJCMvYPWHhwb+176LwiFvoft uF3hdtp8MQjTsaRp98WIHqb8Qp8/1rUzC0Bd9P4etP8VDzHZIJK/JupMpDPfmoTBhHqF y+mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:message-id:date:to:from; bh=9xH6Zoow8rvVuV/kW3VoitksGJALTR/KZycfuoNLdQI=; b=tsCq2BQxPhWHCcXTDY3nIzgV2D4tPN7tVoJZJTOfkBxeaLv8F3TX7tpmSMtyAiW8QA K0v4MgORHeFTKPJ16xHfUg40/Q+/YmMNJ+ktM7itRtBdKxfLSIGx/lKW5ajb+p+HaSe8 CeFxLoccIx4A27tXsy2pmE5O73rvwZ2pqHHYllblGGKYOQaV+X8lclYH0LjrbdvtxpiW 6Nu5NF3EwI6n+HN7KMORAQHCd5rROQLI20gIbcdjpQ0C92ZzcZnlj8/Yxvq40TFiETTX IREnK3NM9iGb8hMpoWeos7v+P9AREq4RLD4OtHVj+TCRtv4myo39iBRInYoKexrTF74s 2Oeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f189si7696572ywh.190.2019.02.18.02.06.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Feb 2019 02:06:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1gvfmF-0000zh-7U; Mon, 18 Feb 2019 10:03:55 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1gvfmE-0000zc-6I for xen-devel@lists.xenproject.org; Mon, 18 Feb 2019 10:03:54 +0000 X-Inumbo-ID: 7e976e82-3364-11e9-bc90-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 7e976e82-3364-11e9-bc90-bc764e045a96; Mon, 18 Feb 2019 10:03:52 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3453E80D; Mon, 18 Feb 2019 02:03:52 -0800 (PST) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 002FA3F589; Mon, 18 Feb 2019 02:03:50 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 18 Feb 2019 10:03:45 +0000 Message-Id: <20190218100345.30383-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Subject: [Xen-devel] [PATCH for-4.12] xen/arm: domain_build: Require the property "cpus" when building a domU X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Artem_Mygaiev@epam.com, jgross@suse.com, sstabellini@kernel.org, Andrii_Anisov@epam.com, Oleksandr_Tyshchenko@epam.com, Julien Grall MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The 3rd argument of function dt_property_read_u32() is only valid when the call succeeded. So we cannot assume the value will not be modifed in case of failure. The documentation of Dom0less does not give a default value when the property "cpus" is not set. So require the property in the configuration. Coverity-ID: 1476825 Signed-off-by: Julien Grall --- xen/arch/arm/domain_build.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 31af989e63..0d93042c5e 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2069,7 +2069,6 @@ void __init create_domUs(void) .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE, .arch.nr_spis = 0, .flags = XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap, - .max_vcpus = 1, .max_evtchn_port = -1, .max_grant_frames = 64, .max_maptrack_frames = 1024, @@ -2080,7 +2079,9 @@ void __init create_domUs(void) if ( dt_property_read_bool(node, "vpl011") ) d_cfg.arch.nr_spis = GUEST_VPL011_SPI - 32 + 1; - dt_property_read_u32(node, "cpus", &d_cfg.max_vcpus); + + if ( !dt_property_read_u32(node, "cpus", &d_cfg.max_vcpus) ) + panic("Missing property 'cpus' for domain %s", dt_node_name(node)); d = domain_create(++max_init_domid, &d_cfg, false); if ( IS_ERR(d) )