summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhhuan13 <hhuan13@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-14 07:47:29 +0000
committerhhuan13 <hhuan13@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-14 07:47:29 +0000
commit29a4f92d814896a7c15e5fd0559defa4d7232c53 (patch)
tree3870ed46aba7dda643889f08a2b17589b64683c5
parentd60957b8562d00e33b6e78626891fc80b0375cf3 (diff)
downloadedk2-platforms-29a4f92d814896a7c15e5fd0559defa4d7232c53.tar.xz
Fix 3 K8 issues for PXE module
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10489 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c2
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c31
2 files changed, 31 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index 2b0c9e0a8b..2dc7471fe2 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -1832,6 +1832,8 @@ PxeBcSelectBootMenu (
gST->ConOut->SetCursorPosition (gST->ConOut, 0, TopRow + MenuNum);
} while (!Finish);
+ ASSERT (Select < PXEBC_MAX_MENU_NUM);
+
//
// Swap the byte order
//
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index 57f588efd3..54b82bd3bb 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -749,6 +749,7 @@ EfiPxeBcDiscover (
PXEBC_PRIVATE_DATA *Private;
EFI_PXE_BASE_CODE_MODE *Mode;
EFI_PXE_BASE_CODE_DISCOVER_INFO DefaultInfo;
+ EFI_PXE_BASE_CODE_DISCOVER_INFO *CreatedInfo;
EFI_PXE_BASE_CODE_SRVLIST *SrvList;
EFI_PXE_BASE_CODE_SRVLIST DefaultSrvList;
PXEBC_CACHED_DHCP4_PACKET *Packet;
@@ -765,6 +766,7 @@ EfiPxeBcDiscover (
Mode = Private->PxeBc.Mode;
BootSvrEntry = NULL;
SrvList = NULL;
+ CreatedInfo = NULL;
Status = EFI_DEVICE_ERROR;
Private->Function = EFI_PXE_BASE_CODE_FUNCTION_DISCOVER;
@@ -831,6 +833,8 @@ EfiPxeBcDiscover (
}
DefaultInfo.IpCnt = 0;
+ Info = &DefaultInfo;
+ SrvList = Info->SrvList;
if (DefaultInfo.MustUseList) {
BootSvrEntry = VendorOpt->BootSvr;
@@ -851,9 +855,25 @@ EfiPxeBcDiscover (
}
DefaultInfo.IpCnt = BootSvrEntry->IpCnt;
+
+ if (DefaultInfo.IpCnt >= 1) {
+ CreatedInfo = AllocatePool (sizeof (DefaultInfo) + (DefaultInfo.IpCnt - 1) * sizeof (*SrvList));
+ if (CreatedInfo == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (CreatedInfo, &DefaultInfo, sizeof (DefaultInfo));
+ Info = CreatedInfo;
+ SrvList = Info->SrvList;
+ }
+
+ for (Index = 0; Index < DefaultInfo.IpCnt; Index++) {
+ CopyMem (&SrvList[Index].IpAddr, &BootSvrEntry->IpAddr[Index], sizeof (EFI_IPv4_ADDRESS));
+ SrvList[Index].AcceptAnyResponse = FALSE;
+ SrvList[Index].Type = BootSvrEntry->Type;
+ }
}
- Info = &DefaultInfo;
} else {
SrvList = Info->SrvList;
@@ -904,6 +924,9 @@ EfiPxeBcDiscover (
TRUE,
&Private->PxeReply.Packet.Ack
);
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
}
} else if (Info->UseMCast) {
@@ -953,6 +976,10 @@ EfiPxeBcDiscover (
);
}
+ if (CreatedInfo != NULL) {
+ FreePool (CreatedInfo);
+ }
+
return Status;
}
@@ -1524,7 +1551,7 @@ EfiPxeBcUdpRead (
return EFI_INVALID_PARAMETER;
}
- if ((BufferSize == NULL) || ((BufferPtr == NULL) && (*BufferSize != 0))) {
+ if ((BufferSize == NULL) || (BufferPtr == NULL)) {
return EFI_INVALID_PARAMETER;
}