From patchwork Wed Dec 13 16:10:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13491588 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48D8CC4332F for ; Wed, 13 Dec 2023 16:12:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.654094.1020771 (Exim 4.92) (envelope-from ) id 1rDRqV-0000DJ-PM; Wed, 13 Dec 2023 16:12:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 654094.1020771; Wed, 13 Dec 2023 16:12:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rDRqV-0000DA-MR; Wed, 13 Dec 2023 16:12:27 +0000 Received: by outflank-mailman (input) for mailman id 654094; Wed, 13 Dec 2023 16:12:26 +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 1rDRqU-00009X-1O for xen-devel@lists.xenproject.org; Wed, 13 Dec 2023 16:12:26 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6738794a-99d2-11ee-98e9-6d05b1d4d9a1; Wed, 13 Dec 2023 17:12:25 +0100 (CET) Received: from beta.station (net-37-182-35-120.cust.vodafonedsl.it [37.182.35.120]) by support.bugseng.com (Postfix) with ESMTPSA id 63DCC4EE0737; Wed, 13 Dec 2023 17:12:24 +0100 (CET) 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: 6738794a-99d2-11ee-98e9-6d05b1d4d9a1 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Maria Celeste Cesario , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Simone Ballarin Subject: [PATCH v2 2/2] xen/x86_emulate: address violations of MISRA C:2012 Rule 14.4 Date: Wed, 13 Dec 2023 17:10:51 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario The xen sources contain violations of MISRA C:2012 Rule 14.4 whose headline states: "The controlling expression of an if statement and the controlling expression of an iteration-statement shall have essentially Boolean type". Add comparisons to avoid using enum constants as controlling expressions to comply with Rule 14.4. No functional change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Acked-by: Jan Beulich --- Changes in v2: - move changes on hpet.c and msi.c to x86/IOMMU patch. - rename prefix from xen/x86 to xen/x86_emulate. --- xen/arch/x86/x86_emulate/x86_emulate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index cf780da501..00b7365ed3 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1320,7 +1320,7 @@ x86_emulate( ea.bytes = 2; goto srcmem_common; case SrcMem: - if ( state->simd_size ) + if ( state->simd_size != simd_none ) break; ea.bytes = (d & ByteOp) ? 1 : op_bytes; srcmem_common: @@ -1460,7 +1460,7 @@ x86_emulate( /* Becomes a normal DstMem operation from here on. */ case DstMem: generate_exception_if(ea.type == OP_MEM && evex.z, X86_EXC_UD); - if ( state->simd_size ) + if ( state->simd_size != simd_none ) { generate_exception_if(lock_prefix, X86_EXC_UD); break; @@ -8176,7 +8176,7 @@ x86_emulate( goto done; } - if ( state->rmw ) + if ( state->rmw != rmw_NONE ) { ea.val = src.val; op_bytes = dst.bytes; @@ -8205,7 +8205,7 @@ x86_emulate( dst.type = OP_NONE; } - else if ( state->simd_size ) + else if ( state->simd_size != simd_none ) { generate_exception_if(!op_bytes, X86_EXC_UD); generate_exception_if((vex.opcx && (d & TwoOp) &&