From nobody Thu May 16 18:23:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of 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.zohomail.com with SMTPS id 1689922269038547.2736158962899; Thu, 20 Jul 2023 23:51:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.567366.886326 (Exim 4.92) (envelope-from ) id 1qMjyL-0006lC-Lq; Fri, 21 Jul 2023 06:50:41 +0000 Received: by outflank-mailman (output) from mailman id 567366.886326; Fri, 21 Jul 2023 06:50:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qMjyL-0006l5-IK; Fri, 21 Jul 2023 06:50:41 +0000 Received: by outflank-mailman (input) for mailman id 567366; Fri, 21 Jul 2023 06:50:40 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qMjyK-0006kz-U6 for xen-devel@lists.xenproject.org; Fri, 21 Jul 2023 06:50:40 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e6f2eba8-2792-11ee-b23a-6b7b168915f2; Fri, 21 Jul 2023 08:50:39 +0200 (CEST) Received: from nico.bugseng.com (unknown [37.162.18.33]) by support.bugseng.com (Postfix) with ESMTPSA id D8F394EE0C89; Fri, 21 Jul 2023 08:50:36 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e6f2eba8-2792-11ee-b23a-6b7b168915f2 From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Nicola Vetrini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [XEN PATCH] xen/arm: p2m: refactor 'p2m_get_entry' Date: Fri, 21 Jul 2023 08:49:58 +0200 Message-Id: <118566cd8b9ebbcedd2b610f5f602cc31c12fd55.1689922099.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1689922270392100001 Content-Type: text/plain; charset="utf-8" This function is refactored to avoid using a local dummy variable that served as a fallback if the parameter 't' is NULL. Storing the address of that variable into 't' caused static analysis tools not to be able to recognize the validity of the initialization, and to help with automatic checking the two usages of 't' have been slightly refactored. No functional changes. Signed-off-by: Nicola Vetrini Suggested-by: Julien Grall --- xen/arch/arm/p2m.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index de32a2d638..05d65db01b 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -496,16 +496,13 @@ mfn_t p2m_get_entry(struct p2m_domain *p2m, gfn_t gfn, lpae_t entry, *table; int rc; mfn_t mfn =3D INVALID_MFN; - p2m_type_t _t; DECLARE_OFFSETS(offsets, addr); =20 ASSERT(p2m_is_locked(p2m)); BUILD_BUG_ON(THIRD_MASK !=3D PAGE_MASK); =20 - /* Allow t to be NULL */ - t =3D t ?: &_t; - - *t =3D p2m_invalid; + if ( t ) + *t =3D p2m_invalid; =20 if ( valid ) *valid =3D false; @@ -549,7 +546,8 @@ mfn_t p2m_get_entry(struct p2m_domain *p2m, gfn_t gfn, =20 if ( p2m_is_valid(entry) ) { - *t =3D entry.p2m.type; + if ( t ) + *t =3D entry.p2m.type; =20 if ( a ) *a =3D p2m_mem_access_radix_get(p2m, gfn); --=20 2.34.1