From nobody Wed Nov 27 21:40:27 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 1690454932438235.89328271304714; Thu, 27 Jul 2023 03:48:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.571008.893809 (Exim 4.92) (envelope-from ) id 1qOyXt-0007XR-OR; Thu, 27 Jul 2023 10:48:37 +0000 Received: by outflank-mailman (output) from mailman id 571008.893809; Thu, 27 Jul 2023 10:48:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qOyXt-0007XJ-Kh; Thu, 27 Jul 2023 10:48:37 +0000 Received: by outflank-mailman (input) for mailman id 571008; Thu, 27 Jul 2023 10:48:35 +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 1qOyXr-00072A-UA for xen-devel@lists.xenproject.org; Thu, 27 Jul 2023 10:48:35 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 22dfe1fc-2c6b-11ee-b247-6b7b168915f2; Thu, 27 Jul 2023 12:48:35 +0200 (CEST) Received: from nico.bugseng.com (unknown [37.161.207.213]) by support.bugseng.com (Postfix) with ESMTPSA id 25CF34EE0742; Thu, 27 Jul 2023 12:48:34 +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: 22dfe1fc-2c6b-11ee-b247-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 , Paul Durrant , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH 2/4] x86/emulate: move a variable declaration to address MISRA C:2012 Rule 5.3 Date: Thu, 27 Jul 2023 12:48:00 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1690454933645100004 Content-Type: text/plain; charset="utf-8" The declaration of local variable 'bytes' in 'hvmemul_rep_stos' causes the shadowing of the same variable defined in the enclosing scope, hence the declaration has been moved inside the scope where it's used, with a different name. Signed-off-by: Nicola Vetrini --- xen/arch/x86/hvm/emulate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 75ee98a73b..0d41928ff3 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -2024,15 +2024,15 @@ static int cf_check hvmemul_rep_stos( =20 switch ( p2mt ) { - unsigned long bytes; char *buf; =20 default: /* Allocate temporary buffer. */ for ( ; ; ) { - bytes =3D *reps * bytes_per_rep; - buf =3D xmalloc_bytes(bytes); + unsigned long bytes_tmp; + bytes_tmp =3D *reps * bytes_per_rep; + buf =3D xmalloc_bytes(bytes_tmp); if ( buf || *reps <=3D 1 ) break; *reps >>=3D 1; --=20 2.34.1