[PATCH v2 2/2] MdeModulePkg/Ip4Dxe: Correct the return status


Jiaxin Wu <jiaxin.wu@...>
 

This patch made the following change:
* DataItem->Status should be updated to the status code.
* Data should not be freed if EFI_NOT_READY returned.

Cc: Santhapur Naveen <naveens@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Ye Ting <ting.ye@...>
Cc: Fu Siyuan <siyuan.fu@...>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@...>
---
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index 5b01b35..88ead9d 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -1280,25 +1280,21 @@ Ip4Config2SetMaunualAddress (
DataItem->DataSize = DataSize;
DataItem->Status = EFI_NOT_READY;

IpSb->Reconfig = TRUE;
Status = Ip4Config2SetDefaultAddr (IpSb, StationAddress, SubnetMask);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }

- DataItem->Status = EFI_SUCCESS;
+ DataItem->Status = Status;

-ON_EXIT:
- if (EFI_ERROR (DataItem->Status)) {
+ if (EFI_ERROR (DataItem->Status) && DataItem->Status != EFI_NOT_READY) {
if (Ptr != NULL) {
FreePool (Ptr);
}
DataItem->Data.Ptr = NULL;
}

- return EFI_SUCCESS;
+ return Status;
}

/**
The work function is to set the gateway addresses manually for the EFI IPv4
network stack that is running on the communication device that this EFI IPv4
--
1.9.5.msysgit.1

Join {devel@edk2.groups.io to automatically receive all group messages.