]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
refine the code and add more security check.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Driver.c
index 76c55c4478bcf861292e049cb16ecdc684619464..3136652f9869309b16a42745fc36421a460f9e99 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation.<BR>\r
+Copyright (c) 2006 - 2010, Intel Corporation.<BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -32,7 +32,7 @@ EFI_SERVICE_BINDING_PROTOCOL mDhcp4ServiceBindingTemplate = {
   This is the declaration of an EFI image entry point. This entry point is\r
   the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
   both device drivers and bus drivers.\r
   This is the declaration of an EFI image entry point. This entry point is\r
   the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
   both device drivers and bus drivers.\r
-  \r
+\r
   Entry point of the DHCP driver to install various protocols.\r
 \r
   @param[in]  ImageHandle           The firmware allocated handle for the UEFI image.\r
   Entry point of the DHCP driver to install various protocols.\r
 \r
   @param[in]  ImageHandle           The firmware allocated handle for the UEFI image.\r
@@ -315,6 +315,7 @@ Dhcp4DriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+  ASSERT (DhcpSb != NULL);\r
 \r
   //\r
   // Start the receiving\r
 \r
   //\r
   // Start the receiving\r
@@ -360,7 +361,7 @@ ON_ERROR:
   restrictions for this service. DisconnectController()\r
   must follow these calling restrictions. If any other agent wishes\r
   to call Stop() it must also follow these calling restrictions.\r
   restrictions for this service. DisconnectController()\r
   must follow these calling restrictions. If any other agent wishes\r
   to call Stop() it must also follow these calling restrictions.\r
-  \r
+\r
   @param[in]  This              Protocol instance pointer.\r
   @param[in]  ControllerHandle  Handle of device to stop driver on\r
   @param[in]  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
   @param[in]  This              Protocol instance pointer.\r
   @param[in]  ControllerHandle  Handle of device to stop driver on\r
   @param[in]  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
@@ -482,14 +483,14 @@ DhcpInitProtocol (
 \r
 /**\r
   Creates a child handle and installs a protocol.\r
 \r
 /**\r
   Creates a child handle and installs a protocol.\r
-  \r
-  The CreateChild() function installs a protocol on ChildHandle. \r
-  If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle. \r
+\r
+  The CreateChild() function installs a protocol on ChildHandle.\r
+  If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r
   If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
 \r
   @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
   @param  ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
   If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
 \r
   @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
   @param  ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
-                      then a new handle is created. If it is a pointer to an existing UEFI handle, \r
+                      then a new handle is created. If it is a pointer to an existing UEFI handle,\r
                       then the protocol is added to the existing UEFI handle.\r
 \r
   @retval EFI_SUCCES            The protocol was added to ChildHandle.\r
                       then the protocol is added to the existing UEFI handle.\r
 \r
   @retval EFI_SUCCES            The protocol was added to ChildHandle.\r
@@ -578,9 +579,9 @@ Dhcp4ServiceBindingCreateChild (
 \r
 /**\r
   Destroys a child handle with a protocol installed on it.\r
 \r
 /**\r
   Destroys a child handle with a protocol installed on it.\r
-  \r
-  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol \r
-  that was installed by CreateChild() from ChildHandle. If the removed protocol is the \r
+\r
+  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
+  that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
   last protocol on ChildHandle, then ChildHandle is destroyed.\r
 \r
   @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
   last protocol on ChildHandle, then ChildHandle is destroyed.\r
 \r
   @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r