From 222e2854fe6bed443686e3809f155fd7b824fabd Mon Sep 17 00:00:00 2001 From: Abdul Lateef Attar Date: Thu, 19 Sep 2024 09:26:10 +0000 Subject: BaseTools: Update RETURN_ERROR Macro in BaseTypes.h This patch is to sync RETURN_ERROR macro with the MdePkg/Include/Base.h Ref: 1a89d9887f MdePkg:Update Return Error Macro in Base.h Fixing RETURN_ERROR macro. It is causing problem in Coverity Static analysis tool as we are directly converting the UINT value to INTN. Changing value from UINT to INTN might cause problema Here we know that the values would not be in loss of data. To increase the code quality and increase the static tool analysis score we have to change it Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Abdul Lateef Attar --- BaseTools/Source/C/Include/Common/BaseTypes.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'BaseTools') diff --git a/BaseTools/Source/C/Include/Common/BaseTypes.h b/BaseTools/Source/C/Include/Common/BaseTypes.h index e669da894c..5093a2f1f9 100644 --- a/BaseTools/Source/C/Include/Common/BaseTypes.h +++ b/BaseTools/Source/C/Include/Common/BaseTypes.h @@ -4,6 +4,8 @@ This file is stand alone self consistent set of definitions. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -202,7 +204,7 @@ typedef UINTN RETURN_STATUS; #define ENCODE_ERROR(a) ((RETURN_STATUS)(MAX_BIT | (a))) #define ENCODE_WARNING(a) ((RETURN_STATUS)(a)) -#define RETURN_ERROR(a) (((INTN)(RETURN_STATUS)(a)) < 0) +#define RETURN_ERROR(a) (((RETURN_STATUS)(a)) >= MAX_BIT) #define RETURN_SUCCESS 0 #define RETURN_LOAD_ERROR ENCODE_ERROR (1) -- cgit v1.2.3