]> xenbits.xensource.com Git - people/aperard/ovmf.git/commitdiff
MdePkg:Update Return Error Macro in Base.h
authorParth <56894451+parthishere@users.noreply.github.com>
Tue, 6 Aug 2024 16:49:09 +0000 (11:49 -0500)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 3 Sep 2024 18:42:10 +0000 (18:42 +0000)
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 problem. 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: Jiangang He <jiangang.he@amd.com>
Cc: Neo Hsueh <Hong-Chih.Hsueh@amd.com>
Signed-off-by: Parth Thakkar <ParthRajeshkumar.Thakkar@amd.com>
MdePkg/Include/Base.h

index 7caebbeb1f4af759b1904e30333a7556ec2b3bdf..363e0fea40fab87507612ef3dccf22e94573e67f 100644 (file)
@@ -1058,7 +1058,7 @@ typedef UINTN RETURN_STATUS;
   @retval FALSE         The high bit of StatusCode is clear.\r
 \r
 **/\r
-#define RETURN_ERROR(StatusCode)  (((INTN)(RETURN_STATUS)(StatusCode)) < 0)\r
+#define RETURN_ERROR(StatusCode)  (((RETURN_STATUS)(StatusCode)) >= MAX_BIT)\r
 \r
 ///\r
 /// The operation completed successfully.\r