From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.48.1608139353360702276 for ; Wed, 16 Dec 2020 09:22:33 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pierre.gondois@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 05E971FB; Wed, 16 Dec 2020 09:22:33 -0800 (PST) Received: from e120189.arm.com (unknown [10.57.25.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D8FE53F66E; Wed, 16 Dec 2020 09:22:31 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io, ard.biesheuvel@arm.com, leif@nuviainc.com Cc: sami.mujawar@arm.com Subject: [PATCH v1 08/25] ArmPkg: Fix Ecc error 3002 in SemihostFs Date: Wed, 16 Dec 2020 17:21:43 +0000 Message-Id: <20201216172200.25846-9-Pierre.Gondois@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201216172200.25846-1-Pierre.Gondois@arm.com> References: <20201216172200.25846-1-Pierre.Gondois@arm.com> From: Pierre Gondois This patch fixes the following Ecc reported error: Non-Boolean comparisons should use a compare operator (==, !=, >, < >=, <=) Signed-off-by: Pierre Gondois --- The changes can be seen at: https://github.com/PierreARM/edk2/commits/1552_Ecc_ArmPkg_v1 ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c index a66bcb136918..3b07d979182f 100644 --- a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c +++ b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c @@ -2,7 +2,7 @@ Support a Semi Host file system over a debuggers JTAG Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+ Portions copyright (c) 2011 - 2020, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -196,8 +196,8 @@ FileOpen ( return EFI_INVALID_PARAMETER; } - if ((OpenMode & EFI_FILE_MODE_CREATE) && - (Attributes & EFI_FILE_DIRECTORY) ) { + if (((OpenMode & EFI_FILE_MODE_CREATE) != 0) && + ((Attributes & EFI_FILE_DIRECTORY) != 0)) { return EFI_WRITE_PROTECTED; } @@ -234,7 +234,7 @@ FileOpen ( Return = SemihostFileOpen (AsciiFileName, SemihostMode, &SemihostHandle); if (RETURN_ERROR (Return)) { - if (OpenMode & EFI_FILE_MODE_CREATE) { + if ((OpenMode & EFI_FILE_MODE_CREATE) != 0) { // // In the create if does not exist case, if the opening in update // mode failed, create it and open it in update mode. The update @@ -277,7 +277,8 @@ FileOpen ( FileFcb->Info.FileSize = Length; FileFcb->Info.PhysicalSize = Length; - FileFcb->Info.Attribute = (OpenMode & EFI_FILE_MODE_CREATE) ? Attributes : 0; + FileFcb->Info.Attribute = ((OpenMode & EFI_FILE_MODE_CREATE) != 0) ? + Attributes : 0; InsertTailList (&gFileList, &FileFcb->Link); -- 2.17.1