summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-10 06:59:07 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-10 06:59:07 +0000
commita4df47f1090a723108cdd7ae45c9adce8ab5bcca (patch)
treef2104e6cd5b97774c3dbbed85cf67f1d768beb89
parentd2eec3191275e0f799d42e179fc8d8a04290992f (diff)
downloadedk2-a4df47f1090a723108cdd7ae45c9adce8ab5bcca.zip
edk2-a4df47f1090a723108cdd7ae45c9adce8ab5bcca.tar.gz
edk2-a4df47f1090a723108cdd7ae45c9adce8ab5bcca.tar.bz2
1. remove duplicated NetLibDispatchDpc() calling in Pool function.
2. use mde library 3. add security check. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8860 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c12
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c12
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c18
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c26
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c8
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c3
6 files changed, 38 insertions, 41 deletions
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
index 6a4ac62..5ccbefd 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
@@ -253,7 +253,7 @@ Dhcp4CreateService (
ON_ERROR:
Dhcp4CloseService (DhcpSb);
- gBS->FreePool (DhcpSb);
+ FreePool (DhcpSb);
return Status;
}
@@ -334,7 +334,7 @@ Dhcp4DriverBindingStart (
ON_ERROR:
Dhcp4CloseService (DhcpSb);
- gBS->FreePool (DhcpSb);
+ FreePool (DhcpSb);
return Status;
}
@@ -417,7 +417,7 @@ Dhcp4DriverBindingStop (
Dhcp4CloseService (DhcpSb);
- gBS->FreePool (DhcpSb);
+ FreePool (DhcpSb);
} else {
//
// Don't use NET_LIST_FOR_EACH_SAFE here, Dhcp4ServiceBindingDestoryChild
@@ -522,7 +522,7 @@ Dhcp4ServiceBindingCreateChild (
);
if (EFI_ERROR (Status)) {
- gBS->FreePool (Instance);
+ FreePool (Instance);
return Status;
}
@@ -547,7 +547,7 @@ Dhcp4ServiceBindingCreateChild (
NULL
);
- gBS->FreePool (Instance);
+ FreePool (Instance);
return Status;
}
@@ -668,6 +668,6 @@ Dhcp4ServiceBindingDestroyChild (
gBS->RestoreTPL (OldTpl);
- gBS->FreePool (Instance);
+ FreePool (Instance);
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
index 6d82230..9003190 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
@@ -427,21 +427,21 @@ DhcpCleanConfigure (
UINT32 Index;
if (Config->DiscoverTimeout != NULL) {
- gBS->FreePool (Config->DiscoverTimeout);
+ FreePool (Config->DiscoverTimeout);
}
if (Config->RequestTimeout != NULL) {
- gBS->FreePool (Config->RequestTimeout);
+ FreePool (Config->RequestTimeout);
}
if (Config->OptionList != NULL) {
for (Index = 0; Index < Config->OptionCount; Index++) {
if (Config->OptionList[Index] != NULL) {
- gBS->FreePool (Config->OptionList[Index]);
+ FreePool (Config->OptionList[Index]);
}
}
- gBS->FreePool (Config->OptionList);
+ FreePool (Config->OptionList);
}
ZeroMem (Config, sizeof (EFI_DHCP4_CONFIG_DATA));
@@ -564,14 +564,14 @@ DhcpYieldControl (
DhcpSb->ActiveChild = NULL;
if (Config->DiscoverTimeout != NULL) {
- gBS->FreePool (Config->DiscoverTimeout);
+ FreePool (Config->DiscoverTimeout);
Config->DiscoverTryCount = 0;
Config->DiscoverTimeout = NULL;
}
if (Config->RequestTimeout != NULL) {
- gBS->FreePool (Config->RequestTimeout);
+ FreePool (Config->RequestTimeout);
Config->RequestTryCount = 0;
Config->RequestTimeout = NULL;
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
index dc9b041..1b3afa3 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
@@ -446,17 +446,17 @@ DhcpCleanLease (
DhcpSb->ServerAddr = 0;
if (DhcpSb->LastOffer != NULL) {
- gBS->FreePool (DhcpSb->LastOffer);
+ FreePool (DhcpSb->LastOffer);
DhcpSb->LastOffer = NULL;
}
if (DhcpSb->Selected != NULL) {
- gBS->FreePool (DhcpSb->Selected);
+ FreePool (DhcpSb->Selected);
DhcpSb->Selected = NULL;
}
if (DhcpSb->Para != NULL) {
- gBS->FreePool (DhcpSb->Para);
+ FreePool (DhcpSb->Para);
DhcpSb->Para = NULL;
}
@@ -636,7 +636,7 @@ DhcpHandleSelect (
if (Status == EFI_SUCCESS) {
if (DhcpSb->LastOffer != NULL) {
- gBS->FreePool (DhcpSb->LastOffer);
+ FreePool (DhcpSb->LastOffer);
}
DhcpSb->LastOffer = Packet;
@@ -645,7 +645,7 @@ DhcpHandleSelect (
} else if (Status == EFI_NOT_READY) {
if (DhcpSb->LastOffer != NULL) {
- gBS->FreePool (DhcpSb->LastOffer);
+ FreePool (DhcpSb->LastOffer);
}
DhcpSb->LastOffer = Packet;
@@ -907,18 +907,14 @@ DhcpHandleReboot (
//
// OK, get the parameter from server, record the lease
//
- DhcpSb->Para = AllocatePool (sizeof (DHCP_PARAMETER));
-
+ DhcpSb->Para = AllocateCopyPool (sizeof (DHCP_PARAMETER), Para);
if (DhcpSb->Para == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
DhcpSb->Selected = Packet;
- CopyMem (DhcpSb->Para, Para, sizeof (*DhcpSb->Para));
-
Status = DhcpLeaseAcquired (DhcpSb);
-
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1063,7 +1059,7 @@ DhcpInput (
}
if (Para != NULL) {
- gBS->FreePool (Para);
+ FreePool (Para);
}
Packet = NULL;
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c
index 559fd9a..8c40605 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c
@@ -604,7 +604,6 @@ DhcpParseOption (
*OptionPoint = NULL;
if (OptNum == 0) {
- Status = EFI_NOT_FOUND;
goto ON_EXIT;
}
@@ -626,14 +625,14 @@ DhcpParseOption (
Status = DhcpIterateOptions (Packet, DhcpFillOption, &Context);
if (EFI_ERROR (Status)) {
- gBS->FreePool (Options);
+ FreePool (Options);
goto ON_EXIT;
}
*OptionPoint = Options;
ON_EXIT:
- gBS->FreePool (OptCount);
+ FreePool (OptCount);
return Status;
}
@@ -675,7 +674,8 @@ DhcpValidateOptions (
if (EFI_ERROR (Status) || (Count == 0)) {
return Status;
}
-
+ ASSERT (AllOption != NULL);
+
Updated = FALSE;
ZeroMem (&Parameter, sizeof (Parameter));
@@ -710,16 +710,15 @@ DhcpValidateOptions (
}
if (Updated && (Para != NULL)) {
- if ((*Para = AllocatePool (sizeof (DHCP_PARAMETER))) == NULL) {
+ *Para = AllocateCopyPool (sizeof (DHCP_PARAMETER), &Parameter);
+ if (*Para == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
-
- CopyMem (*Para, &Parameter, sizeof (**Para));
}
ON_EXIT:
- gBS->FreePool (AllOption);
+ FreePool (AllOption);
return Status;
}
@@ -825,10 +824,11 @@ DhcpBuild (
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
- ASSERT (SeedOptions != NULL);
- for (Index = 0; Index < (UINT32) Count; Index++) {
- Mark[SeedOptions[Index].Tag] = SeedOptions[Index];
+ if (SeedOptions != NULL) {
+ for (Index = 0; Index < (UINT32) Count; Index++) {
+ Mark[SeedOptions[Index].Tag] = SeedOptions[Index];
+ }
}
//
@@ -888,9 +888,9 @@ DhcpBuild (
ON_ERROR:
if (SeedOptions != NULL) {
- gBS->FreePool (SeedOptions);
+ FreePool (SeedOptions);
}
- gBS->FreePool (Mark);
+ FreePool (Mark);
return Status;
}
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c
index a963039..57b1f7b 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c
+++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c
@@ -962,11 +962,6 @@ MnpReceivePacket (
//
MnpDeliverPacket (MnpServiceData);
- //
- // Dispatch the DPC queued by the NotifyFunction of rx token's events.
- //
- NetLibDispatchDpc ();
-
EXIT:
ASSERT (Nbuf->TotalSize == MnpServiceData->BufferLength);
@@ -1066,5 +1061,8 @@ MnpSystemPoll (
//
MnpReceivePacket (MnpServiceData);
+ //
+ // Dispatch the DPC queued by the NotifyFunction of rx token's events.
+ //
NetLibDispatchDpc ();
}
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c
index 1cbe4e4..f93ee6a 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c
+++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c
@@ -771,6 +771,9 @@ MnpPoll (
//
Status = MnpReceivePacket (Instance->MnpServiceData);
+ //
+ // Dispatch the DPC queued by the NotifyFunction of rx token's events.
+ //
NetLibDispatchDpc ();
ON_EXIT: