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 <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
This commit is contained in:
Pierre Gondois 2020-12-10 16:50:22 +00:00 committed by mergify[bot]
parent 1560fd4225
commit a387f2ee2e
2 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@
Copyright (c) 2009, Hewlett-Packard Company. All rights reserved.<BR> Copyright (c) 2009, Hewlett-Packard Company. All rights reserved.<BR>
Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR> Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR>
Portions copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR> Portions copyright (c) 2011-2021, Arm Limited. All rights reserved.<BR>
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@ -282,12 +282,12 @@ EfiAttributeToArmAttribute (
ArmAttributes |= TT_AF; ArmAttributes |= TT_AF;
// Determine protection attributes // Determine protection attributes
if (EfiAttributes & EFI_MEMORY_RO) { if ((EfiAttributes & EFI_MEMORY_RO) != 0) {
ArmAttributes |= TT_AP_RO_RO; ArmAttributes |= TT_AP_RO_RO;
} }
// Process eXecute Never attribute // Process eXecute Never attribute
if (EfiAttributes & EFI_MEMORY_XP) { if ((EfiAttributes & EFI_MEMORY_XP) != 0) {
ArmAttributes |= TT_PXN_MASK; ArmAttributes |= TT_PXN_MASK;
} }

View File

@ -2,7 +2,7 @@
Copyright (c) 2009, Hewlett-Packard Company. All rights reserved.<BR> Copyright (c) 2009, Hewlett-Packard Company. All rights reserved.<BR>
Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR> Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR>
Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR> Portions copyright (c) 2013-2021, Arm Limited. All rights reserved.<BR>
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@ -366,14 +366,14 @@ EfiAttributeToArmAttribute (
} }
// Determine protection attributes // Determine protection attributes
if (EfiAttributes & EFI_MEMORY_RO) { if ((EfiAttributes & EFI_MEMORY_RO) != 0) {
ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RO_RO; ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RO_RO;
} else { } else {
ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RW_RW; ArmAttributes |= TT_DESCRIPTOR_SECTION_AP_RW_RW;
} }
// Determine eXecute Never attribute // Determine eXecute Never attribute
if (EfiAttributes & EFI_MEMORY_XP) { if ((EfiAttributes & EFI_MEMORY_XP) != 0) {
ArmAttributes |= TT_DESCRIPTOR_SECTION_XN_MASK; ArmAttributes |= TT_DESCRIPTOR_SECTION_XN_MASK;
} }