]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: Fix Ecc error 3002 in ArmDisassemblerLib
authorPierre Gondois <Pierre.Gondois@arm.com>
Thu, 10 Dec 2020 10:40:51 +0000 (10:40 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 6 Jan 2021 16:22:54 +0000 (16:22 +0000)
This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c

index d206cf4ea9087c7332a49a3e364245d581291103..abaacca53a9b27fd58217587a683591ddee86cb5 100644 (file)
@@ -2,6 +2,7 @@
   Default exception handler\r
 \r
   Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
+  Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -367,7 +368,11 @@ DisassembleArmInstruction (
       AsciiSPrint (Buf, Size, "CPS #0x%x", (OpCode & 0x2f));\r
     } else {\r
       imode = (OpCode >> 18) & 0x3;\r
-      Index = AsciiSPrint (Buf, Size, "CPS%a %a%a%a", (imode == 3) ? "ID":"IE", (OpCode & BIT8) ? "A":"", (OpCode & BIT7) ? "I":"", (OpCode & BIT6) ? "F":"");\r
+      Index = AsciiSPrint (Buf, Size, "CPS%a %a%a%a",\r
+                      (imode == 3) ? "ID":"IE",\r
+                      ((OpCode & BIT8) != 0) ? "A":"",\r
+                      ((OpCode & BIT7) != 0) ? "I":"",\r
+                      ((OpCode & BIT6) != 0) ? "F":"");\r
       if ((OpCode & BIT17) != 0) {\r
         AsciiSPrint (&Buf[Index], Size - Index, ", #0x%x", OpCode & 0x1f);\r
       }\r