[edk2-devel] [PATCH edk2-platforms v3 14/16] ManageabilityPkg: Return error on PLDM header check fails

Konstantin Aladyshev aladyshev22 at gmail.com
Mon Oct 23 13:05:09 UTC 2023


Currently PldmSubmit command returns EFI_SUCCESS even if the response
header checks have failed.
Correct the code to return errors in such cases.

Signed-off-by: Konstantin Aladyshev <aladyshev22 at gmail.com>
---
 .../Universal/PldmProtocol/Common/PldmProtocolCommon.c   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c
index bc72ce07b3..04f250e57c 100644
--- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c
+++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolCommon.c
@@ -241,7 +241,7 @@ CommonPldmSubmitCommand (
   if (FullPacketResponseData == NULL) {
     DEBUG ((DEBUG_ERROR, "  Not enough memory for FullPacketResponseDataSize.\n"));
     Status = EFI_OUT_OF_RESOURCES;
-    goto ErrorExit2;
+    goto ErrorExit;
   }
 
   // Print out PLDM packet.
@@ -281,6 +281,7 @@ CommonPldmSubmitCommand (
       FullPacketResponseDataSize
       ));
     HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, TransferToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n");
+    Status = EFI_DEVICE_ERROR;
     goto ErrorExit;
   }
 
@@ -303,6 +304,7 @@ CommonPldmSubmitCommand (
     DEBUG ((DEBUG_ERROR, "    Pldm Completion Code = 0x%x\n", ResponseHeader->PldmCompletionCode));
 
     HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, TransferToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n");
+    Status = EFI_DEVICE_ERROR;
     goto ErrorExit;
   }
 
@@ -319,6 +321,7 @@ CommonPldmSubmitCommand (
       ));
 
     HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, TransferToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n");
+    Status = EFI_DEVICE_ERROR;
     goto ErrorExit;
   }
 
@@ -332,6 +335,7 @@ CommonPldmSubmitCommand (
       ResponseHeader->PldmCompletionCode
       ));
     HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, GET_PLDM_MESSAGE_PAYLOAD_SIZE(TransferToken.ReceivePackage.ReceiveSizeInByte), "Failed response payload\n");
+    Status = EFI_DEVICE_ERROR;
     goto ErrorExit;
   }
 
@@ -350,13 +354,12 @@ CommonPldmSubmitCommand (
 
   // Return transfer status.
   //
-ErrorExit:
   Status = TransferToken.TransferStatus;
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "%a: Failed to send PLDM command over %s\n", __func__, mTransportName));
   }
 
-ErrorExit2:
+ErrorExit:
   if (PldmTransportHeader != NULL) {
     FreePool ((VOID *)PldmTransportHeader);
   }
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109922): https://edk2.groups.io/g/devel/message/109922
Mute This Topic: https://groups.io/mt/102134664/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list