Skip to content

Commit

Permalink
BaseTools: Update RETURN_ERROR Macro in BaseTypes.h
Browse files Browse the repository at this point in the history
This patch is to sync RETURN_ERROR macro with the
MdePkg/Include/Base.h

Ref: 1a89d98 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 <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Bob Feng <[email protected]>
Cc: Yuwei Chen <[email protected]>
Signed-off-by: Abdul Lateef Attar <[email protected]>
  • Loading branch information
Abdul Lateef Attar authored and mergify[bot] committed Sep 20, 2024
1 parent c358009 commit 222e285
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion BaseTools/Source/C/Include/Common/BaseTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
This file is stand alone self consistent set of definitions.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 222e285

Please sign in to comment.