]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/SnpDxe/Snp.c
refine the code and add more security check.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / Snp.c
index 213b724e5f6da7691df0fc338e3d9ba955f4189d..606b096328eae5e1a3019f88313e3af4f9c7120c 100644 (file)
@@ -1,11 +1,11 @@
 /** @file\r
   Implementation of driver entry point and driver binding protocol.\r
\r
-Copyright (c) 2004 - 2009, Intel Corporation. <BR> \r
-All rights reserved. This program and the accompanying materials are licensed \r
-and made available under the terms and conditions of the BSD License which \r
-accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
+\r
+Copyright (c) 2004 - 2010, Intel Corporation. <BR>\r
+All rights reserved. This program and the accompanying materials are licensed\r
+and made available under the terms and conditions of the BSD License which\r
+accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
@@ -49,13 +49,13 @@ SnpNotifyExitBootServices (
 \r
 /**\r
   Send command to UNDI. It does nothing currently.\r
-  \r
+\r
   @param Cdb   command to be sent to UNDI.\r
-   \r
-  @retval EFI_INVALID_PARAMETER  The command is 0. \r
-  @retval EFI_UNSUPPORTED        Default return status because it's not \r
+\r
+  @retval EFI_INVALID_PARAMETER  The command is 0.\r
+  @retval EFI_UNSUPPORTED        Default return status because it's not\r
                                  supported currently.\r
-   \r
+\r
 **/\r
 EFI_STATUS\r
 IssueHwUndiCommand (\r
@@ -81,7 +81,7 @@ IssueHwUndiCommand (
   @param  Buffer               Pointer to buffer.\r
   @param  Length               Length of buffer in bytes.\r
 \r
-  @return 8-bit checksum of all bytes in buffer, or zero if ptr is NULL or len \r
+  @return 8-bit checksum of all bytes in buffer, or zero if ptr is NULL or len\r
           is zero.\r
 \r
 **/\r
@@ -178,7 +178,7 @@ SimpleNetworkDriverSupported (
   //\r
   // Check to see if !PXE structure is valid. Paragraph alignment of !PXE structure is required.\r
   //\r
-  if (NiiProtocol->Id & 0x0F) {\r
+  if ((NiiProtocol->Id & 0x0F) != 0) {\r
     DEBUG ((EFI_D_NET, "\n!PXE structure is not paragraph aligned.\n"));\r
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
@@ -615,7 +615,7 @@ SimpleNetworkDriverStart (
 \r
   }\r
 \r
-  if (Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) {\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) != 0) {\r
     Snp->Mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;\r
 \r
   }\r
@@ -725,7 +725,7 @@ NiiError:
   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  This              Protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r