From a387f2ee2e466905b19745bbe047c1c0ab399086 Mon Sep 17 00:00:00 2001 From: Pierre Gondois Date: Thu, 10 Dec 2020 16:50:22 +0000 Subject: [PATCH] ArmPkg: Fix Ecc error 3002 in CpuDxe This patch fixes the following Ecc reported error: Non-Boolean comparisons should use a compare operator (==, !=, >, < >=, <=) Signed-off-by: Pierre Gondois Reviewed-by: Ard Biesheuvel --- ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 6 +++--- ArmPkg/Drivers/CpuDxe/Arm/Mmu.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c index fca2d4f763..4b6bc47e51 100644 --- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c +++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c @@ -2,7 +2,7 @@ Copyright (c) 2009, Hewlett-Packard Company. All rights reserved.
Portions copyright (c) 2010, Apple Inc. All rights reserved.
-Portions copyright (c) 2011-2013, ARM Ltd. All rights reserved.
+Portions copyright (c) 2011-2021, Arm Limited. All rights reserved.
Copyright (c) 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -282,12 +282,12 @@ EfiAttributeToArmAttribute ( ArmAttributes |= TT_AF; // Determine protection attributes - if (EfiAttributes & EFI_MEMORY_RO) { + if ((EfiAttributes & EFI_MEMORY_RO) != 0) { ArmAttributes |= TT_AP_RO_RO; } // Process eXecute Never attribute - if (EfiAttributes & EFI_MEMORY_XP) { + if ((EfiAttributes & EFI_MEMORY_XP) != 0) { ArmAttributes |= TT_PXN_MASK; } diff --git a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c b/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c index 6fb5112a1a..2a668f0788 100644 --- a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c +++ b/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c @@ -2,7 +2,7 @@ Copyright (c) 2009, Hewlett-Packard Company. All rights reserved.
Portions copyright (c) 2010, Apple Inc. All rights reserved.
-Portions copyright (c) 2013, ARM Ltd. All rights reserved.
+Portions copyright (c) 2013-2021, Arm Limited. All rights reserved.
Copyright (c) 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -366,14 +366,14 @@ EfiAttributeToArmAttribute ( } // Determine protection attributes - if (EfiAttributes & EFI_MEMORY_RO) { + if ((EfiAttributes & EFI_MEMORY_RO) != 0) { ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RO_RO; } else { ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RW_RW; } // Determine eXecute Never attribute - if (EfiAttributes & EFI_MEMORY_XP) { + if ((EfiAttributes & EFI_MEMORY_XP) != 0) { ArmAttributes |= TT_DESCRIPTOR_SECTION_XN_MASK; }