public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/4] Fix some issues in Udp6Dxe
@ 2018-01-04  3:20 fanwang2
  2018-01-04  3:20 ` [Patch 1/4] NetworkPkg: Add ASSERT error handling for UDP6 driver fanwang2
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fanwang2 @ 2018-01-04  3:20 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wang Fan

From: Wang Fan <fan.wang@intel.com>

See descriptions in each patch.

Wang Fan (4):
  NetworkPkg: Add ASSERT error handling for UDP6 driver
  NetworkPkg: Fix a memory leak issue in UDP6 driver
  NetworkPkg: Fix some coding style issues in UDP6 driver
  NetworkPkg: Add more parameter or return status check in UDP6 driver

 NetworkPkg/Udp6Dxe/Udp6Driver.c | 68 ++++++++++++++++++++++-------------------
 NetworkPkg/Udp6Dxe/Udp6Impl.c   | 43 +++++++++++++++++++++++---
 NetworkPkg/Udp6Dxe/Udp6Main.c   | 14 +++++++--
 3 files changed, 86 insertions(+), 39 deletions(-)

-- 
1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Patch 1/4] NetworkPkg: Add ASSERT error handling for UDP6 driver
  2018-01-04  3:20 [Patch 0/4] Fix some issues in Udp6Dxe fanwang2
@ 2018-01-04  3:20 ` fanwang2
  2018-01-04  3:20 ` [Patch 2/4] NetworkPkg: Fix a memory leak issue in " fanwang2
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fanwang2 @ 2018-01-04  3:20 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wang Fan, Ye Ting, Jiaxin Wu, Fu Siyuan

From: Wang Fan <fan.wang@intel.com>

In Udp6Dxe, there are several places use ASSERT to check returned
value. But these errors should be handled if they occur, this patch
is to fix this issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
 NetworkPkg/Udp6Dxe/Udp6Impl.c | 16 +++++++++++++++-
 NetworkPkg/Udp6Dxe/Udp6Main.c |  7 ++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/Udp6Dxe/Udp6Impl.c b/NetworkPkg/Udp6Dxe/Udp6Impl.c
index edf2c23..25d4e6a 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Impl.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Impl.c
@@ -1,9 +1,9 @@
 /** @file
   Udp6 driver's whole implementation.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
@@ -1606,10 +1606,14 @@ Udp6Demultiplex (
   //
   // Get the datagram header from the packet buffer.
   //
   Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
   ASSERT (Udp6Header != NULL);
+  if (Udp6Header == NULL) {
+    NetbufFree (Packet);
+    return;
+  }
 
   if (Udp6Header->Checksum != 0) {
     //
     // check the checksum.
     //
@@ -1716,10 +1720,13 @@ Udp6SendPortUnreach (
   //
   // Get the Ipv6 Mode Data.
   //
   Ip6ModeData = AllocateZeroPool (sizeof (EFI_IP6_MODE_DATA));
   ASSERT (Ip6ModeData != NULL);
+  if (Ip6ModeData == NULL) {
+    goto EXIT;
+  }
 
   //
   // If not finding the related IpSender use the default IpIo to send out
   // the port unreachable ICMP message.
   //
@@ -1764,10 +1771,13 @@ Udp6SendPortUnreach (
   //
   // Allocate space for the IP6_ICMP_ERROR_HEAD.
   //
   IcmpErrHdr = (IP6_ICMP_ERROR_HEAD *) NetbufAllocSpace (Packet, Len, FALSE);
   ASSERT (IcmpErrHdr != NULL);
+  if (IcmpErrHdr == NULL) {
+    goto EXIT;
+  }
 
   //
   // Set the required fields for the icmp port unreachable message.
   //
   IcmpErrHdr->Head.Type     = ICMP_V6_DEST_UNREACHABLE;
@@ -1845,10 +1855,14 @@ Udp6IcmpHandler (
     return;
   }
   
   Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
   ASSERT (Udp6Header != NULL);
+  if (Udp6Header == NULL) {
+    NetbufFree (Packet);
+    return;
+  }
 
   IP6_COPY_ADDRESS (&Udp6Session.SourceAddress, &NetSession->Source);
   IP6_COPY_ADDRESS (&Udp6Session.DestinationAddress, &NetSession->Dest);
 
   Udp6Session.SourcePort      = NTOHS (Udp6Header->DstPort);
diff --git a/NetworkPkg/Udp6Dxe/Udp6Main.c b/NetworkPkg/Udp6Dxe/Udp6Main.c
index f3e9925..9105ef4 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Main.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Main.c
@@ -1,9 +1,9 @@
 /** @file
   Contains all EFI_UDP6_PROTOCOL interfaces.
 
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
@@ -523,10 +523,15 @@ Udp6Transmit (
   Udp6Service                        = Instance->Udp6Service;
   *((UINTN *) &Packet->ProtoData[0]) = (UINTN) (Udp6Service->IpIo);
 
   Udp6Header = (EFI_UDP_HEADER *) NetbufAllocSpace (Packet, UDP6_HEADER_SIZE, TRUE);
   ASSERT (Udp6Header != NULL);
+  if (Udp6Header == NULL) {
+    Status = EFI_OUT_OF_RESOURCES;
+    goto ON_EXIT;
+  }
+  
   ConfigData = &Instance->ConfigData;
 
   //
   // Fill the udp header.
   //
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Patch 2/4] NetworkPkg: Fix a memory leak issue in UDP6 driver
  2018-01-04  3:20 [Patch 0/4] Fix some issues in Udp6Dxe fanwang2
  2018-01-04  3:20 ` [Patch 1/4] NetworkPkg: Add ASSERT error handling for UDP6 driver fanwang2
@ 2018-01-04  3:20 ` fanwang2
  2018-01-04  3:20 ` [Patch 3/4] NetworkPkg: Fix some coding style issues " fanwang2
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fanwang2 @ 2018-01-04  3:20 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wang Fan, Ye Ting, Jiaxin Wu, Fu Siyuan

From: Wang Fan <fan.wang@intel.com>

In UDP6Dxe Udp6Groups(), the code return directly without free the
buffer allocated for McastIp when JoinFlag is TRUE. It is a memory
leak issue that needs to be fixed. This patch is to fix this issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
 NetworkPkg/Udp6Dxe/Udp6Main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NetworkPkg/Udp6Dxe/Udp6Main.c b/NetworkPkg/Udp6Dxe/Udp6Main.c
index 9105ef4..8495bc3 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Main.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Main.c
@@ -349,10 +349,13 @@ Udp6Groups (
     }
   }
 
   Instance = UDP6_INSTANCE_DATA_FROM_THIS (This);
   if (!Instance->Configured) {
+    if (McastIp != NULL) {
+      FreePool (McastIp);
+    }
     return EFI_NOT_STARTED;
   }
 
   Ip      = Instance->IpInfo->Ip.Ip6;
 
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Patch 3/4] NetworkPkg: Fix some coding style issues in UDP6 driver
  2018-01-04  3:20 [Patch 0/4] Fix some issues in Udp6Dxe fanwang2
  2018-01-04  3:20 ` [Patch 1/4] NetworkPkg: Add ASSERT error handling for UDP6 driver fanwang2
  2018-01-04  3:20 ` [Patch 2/4] NetworkPkg: Fix a memory leak issue in " fanwang2
@ 2018-01-04  3:20 ` fanwang2
  2018-01-04  3:20 ` [Patch 4/4] NetworkPkg: Add more parameter or return status check " fanwang2
  2018-01-11  5:37 ` [Patch 0/4] Fix some issues in Udp6Dxe Wu, Jiaxin
  4 siblings, 0 replies; 6+ messages in thread
From: fanwang2 @ 2018-01-04  3:20 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wang Fan, Ye Ting, Jiaxin Wu, Fu Siyuan

From: Wang Fan <fan.wang@intel.com>

In UDP6Dxe, there are some coding style issues, this patch
is to fix these issues.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
 NetworkPkg/Udp6Dxe/Udp6Driver.c | 20 ++++++++++----------
 NetworkPkg/Udp6Dxe/Udp6Impl.c   | 10 ++++++----
 NetworkPkg/Udp6Dxe/Udp6Main.c   |  2 +-
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/NetworkPkg/Udp6Dxe/Udp6Driver.c b/NetworkPkg/Udp6Dxe/Udp6Driver.c
index a4b1104..6dde1fc 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Driver.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Driver.c
@@ -1,9 +1,9 @@
 /** @file
   Driver Binding functions and Service Binding functions for the Network driver module.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
@@ -162,11 +162,10 @@ Udp6DriverBindingStart (
                   &Udp6Service->ServiceBinding,
                   NULL
                   );
   if (EFI_ERROR (Status)) {
     Udp6CleanService (Udp6Service);
-    goto EXIT;
   }
 
 EXIT:
   if (EFI_ERROR (Status)) {
     if (Udp6Service != NULL) {
@@ -180,12 +179,13 @@ EXIT:
   Callback function which provided by user to remove one node in NetDestroyLinkList process.
   
   @param[in]    Entry           The entry to be removed.
   @param[in]    Context         Pointer to the callback context corresponds to the Context in NetDestroyLinkList.
 
-  @retval EFI_SUCCESS           The entry has been removed successfully.
-  @retval Others                Fail to remove the entry.
+  @retval EFI_INVALID_PARAMETER  Entry is NULL or Context is NULL.
+  @retval EFI_SUCCESS            The entry has been removed successfully.
+  @retval Others                 Fail to remove the entry.
 
 **/
 EFI_STATUS
 EFIAPI
 Udp6DestroyChildEntryInHandleBuffer (
@@ -241,16 +241,16 @@ Udp6DriverBindingStop (
   IN  EFI_HANDLE                   ControllerHandle,
   IN  UINTN                        NumberOfChildren,
   IN  EFI_HANDLE                   *ChildHandleBuffer OPTIONAL
   )
 {
-  EFI_STATUS                    Status;
-  EFI_HANDLE                    NicHandle;
-  EFI_SERVICE_BINDING_PROTOCOL  *ServiceBinding;
-  UDP6_SERVICE_DATA             *Udp6Service;
-  LIST_ENTRY                    *List;
-  UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
+  EFI_STATUS                                Status;
+  EFI_HANDLE                                NicHandle;
+  EFI_SERVICE_BINDING_PROTOCOL              *ServiceBinding;
+  UDP6_SERVICE_DATA                         *Udp6Service;
+  LIST_ENTRY                                *List;
+  UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT  Context;
 
   //
   // Find the NicHandle where UDP6 ServiceBinding Protocol is installed.
   //
   NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp6ProtocolGuid);
diff --git a/NetworkPkg/Udp6Dxe/Udp6Impl.c b/NetworkPkg/Udp6Dxe/Udp6Impl.c
index 25d4e6a..458470c 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Impl.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Impl.c
@@ -156,11 +156,12 @@ Udp6RecycleRxDataWrap (
   @param[in]  Packet             Pointer to the buffer containing the received
                                  datagram.
   @param[in]  RxData             Pointer to the EFI_UDP6_RECEIVE_DATA of this
                                  datagram.
 
-  @return Pointer to the structure wrapping the RxData and the Packet.
+  @return Pointer to the structure wrapping the RxData and the Packet. NULL will
+          be returned if any error occurs.
 
 **/
 UDP6_RXDATA_WRAP *
 Udp6WrapRxData (
   IN UDP6_INSTANCE_DATA     *Instance,
@@ -1372,11 +1373,12 @@ Udp6RecycleRxDataWrap (
   @param[in]  Packet             Pointer to the buffer containing the received
                                  datagram.
   @param[in]  RxData             Pointer to the EFI_UDP6_RECEIVE_DATA of this
                                  datagram.
 
-  @return Pointer to the structure wrapping the RxData and the Packet.
+  @return Pointer to the structure wrapping the RxData and the Packet. NULL will
+          be returned if any error occurs.
 
 **/
 UDP6_RXDATA_WRAP *
 Udp6WrapRxData (
   IN UDP6_INSTANCE_DATA     *Instance,
@@ -1596,11 +1598,11 @@ Udp6Demultiplex (
   UINT16                 HeadSum;
   EFI_UDP6_RECEIVE_DATA  RxData;
   EFI_UDP6_SESSION_DATA  *Udp6Session;
   UINTN                  Enqueued;
 
-  if (Packet->TotalSize < sizeof (EFI_UDP_HEADER)) {
+  if (Packet->TotalSize < UDP6_HEADER_SIZE) {
     NetbufFree (Packet);
     return;
   }
   
   //
@@ -1848,11 +1850,11 @@ Udp6IcmpHandler (
   EFI_UDP_HEADER         *Udp6Header;
   EFI_UDP6_SESSION_DATA  Udp6Session;
   LIST_ENTRY             *Entry;
   UDP6_INSTANCE_DATA     *Instance;
 
-  if (Packet->TotalSize < sizeof (EFI_UDP_HEADER)) {
+  if (Packet->TotalSize < UDP6_HEADER_SIZE) {
     NetbufFree (Packet);
     return;
   }
   
   Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
diff --git a/NetworkPkg/Udp6Dxe/Udp6Main.c b/NetworkPkg/Udp6Dxe/Udp6Main.c
index 8495bc3..53145c3 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Main.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Main.c
@@ -583,11 +583,11 @@ Udp6Transmit (
       Udp6Header->Checksum = Udp6Checksum (Packet, HeadSum);
       if (Udp6Header->Checksum == 0) {
         //
         // If the calculated checksum is 0, fill the Checksum field with all ones.
         //
-        Udp6Header->Checksum = 0XFFFF;
+        Udp6Header->Checksum = 0xffff;
       }
     } else {
       //
       // Set the checksum is zero if the ConfigData->StationAddress is unspcified
       // and the Ipv6 will fill the correct value of this checksum.
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Patch 4/4] NetworkPkg: Add more parameter or return status check in UDP6 driver
  2018-01-04  3:20 [Patch 0/4] Fix some issues in Udp6Dxe fanwang2
                   ` (2 preceding siblings ...)
  2018-01-04  3:20 ` [Patch 3/4] NetworkPkg: Fix some coding style issues " fanwang2
@ 2018-01-04  3:20 ` fanwang2
  2018-01-11  5:37 ` [Patch 0/4] Fix some issues in Udp6Dxe Wu, Jiaxin
  4 siblings, 0 replies; 6+ messages in thread
From: fanwang2 @ 2018-01-04  3:20 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wang Fan, Ye Ting, Jiaxin Wu, Fu Siyuan

From: Wang Fan <fan.wang@intel.com>

In UDP6Dxe, there are several places that may be enhanced
to check input parameters and returned status. This patch
is to fix these issues.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
 NetworkPkg/Udp6Dxe/Udp6Driver.c | 48 +++++++++++++++++++++++------------------
 NetworkPkg/Udp6Dxe/Udp6Impl.c   | 17 +++++++++++++++
 NetworkPkg/Udp6Dxe/Udp6Main.c   |  2 +-
 3 files changed, 45 insertions(+), 22 deletions(-)

diff --git a/NetworkPkg/Udp6Dxe/Udp6Driver.c b/NetworkPkg/Udp6Dxe/Udp6Driver.c
index 6dde1fc..f9d528e 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Driver.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Driver.c
@@ -288,22 +288,19 @@ Udp6DriverBindingStop (
                Udp6DestroyChildEntryInHandleBuffer,
                &Context,
                NULL
                );
   } else if (IsListEmpty (&Udp6Service->ChildrenList)) {
-    gBS->UninstallMultipleProtocolInterfaces (
-           NicHandle,
-           &gEfiUdp6ServiceBindingProtocolGuid,
-           &Udp6Service->ServiceBinding,
-           NULL
-           );
+    Status = gBS->UninstallMultipleProtocolInterfaces (
+               NicHandle,
+               &gEfiUdp6ServiceBindingProtocolGuid,
+               &Udp6Service->ServiceBinding,
+               NULL
+               );
  
     Udp6CleanService (Udp6Service);
-
     FreePool (Udp6Service);
-
-    Status = EFI_SUCCESS;
   }
 
   return Status;
 }
 
@@ -508,25 +505,34 @@ Udp6ServiceBindingDestroyChild (
   Instance->InDestroy = TRUE;
 
   //
   // Close the Ip6 protocol on the default IpIo.
   //
-  gBS->CloseProtocol (
-         Udp6Service->IpIo->ChildHandle,
-         &gEfiIp6ProtocolGuid,
-         gUdp6DriverBinding.DriverBindingHandle,
-         Instance->ChildHandle
-         );
+  Status = gBS->CloseProtocol (
+             Udp6Service->IpIo->ChildHandle,
+             &gEfiIp6ProtocolGuid,
+             gUdp6DriverBinding.DriverBindingHandle,
+             Instance->ChildHandle
+             );
+  if (EFI_ERROR (Status)) {
+    Instance->InDestroy = FALSE;
+    return Status;
+  }
+
   //
   // Close the Ip6 protocol on this instance's IpInfo.
   //
-  gBS->CloseProtocol (
-         Instance->IpInfo->ChildHandle,
-         &gEfiIp6ProtocolGuid,
-         gUdp6DriverBinding.DriverBindingHandle,
-         Instance->ChildHandle
-         );
+  Status = gBS->CloseProtocol (
+             Instance->IpInfo->ChildHandle,
+             &gEfiIp6ProtocolGuid,
+             gUdp6DriverBinding.DriverBindingHandle,
+             Instance->ChildHandle
+             );
+  if (EFI_ERROR (Status)) {
+    Instance->InDestroy = FALSE;
+    return Status;
+  }
 
   //
   // Uninstall the Udp6Protocol previously installed on the ChildHandle.
   //
   Status = gBS->UninstallMultipleProtocolInterfaces (
diff --git a/NetworkPkg/Udp6Dxe/Udp6Impl.c b/NetworkPkg/Udp6Dxe/Udp6Impl.c
index 458470c..d014e2d 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Impl.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Impl.c
@@ -55,10 +55,13 @@ Udp6FindInstanceByPort (
 /**
   This function is the packet transmitting notify function registered to the IpIo
   interface. It's called to signal the udp TxToken when the IpIo layer completes
   transmitting of the udp datagram.
 
+  If Context is NULL, then ASSERT().
+  If NotifyData is NULL, then ASSERT().
+
   @param[in]  Status            The completion status of the output udp datagram.
   @param[in]  Context           Pointer to the context data.
   @param[in]  Sender            Specify a EFI_IP6_PROTOCOL for sending.
   @param[in]  NotifyData        Pointer to the notify data.
 
@@ -73,10 +76,14 @@ Udp6DgramSent (
   );
 
 /**
   This function processes the received datagram passed up by the IpIo layer.
 
+  If NetSession is NULL, then ASSERT().
+  If Packet is NULL, then ASSERT().
+  If Context is NULL, then ASSERT().
+
   @param[in]  Status            The status of this udp datagram.
   @param[in]  IcmpError         The IcmpError code, only available when Status is
                                 EFI_ICMP_ERROR.
   @param[in]  NetSession        Pointer to the EFI_NET_SESSION_DATA.
   @param[in]  Packet            Pointer to the NET_BUF containing the received udp
@@ -975,10 +982,13 @@ Udp6RemoveToken (
 /**
   This function is the packet transmitting notify function registered to the IpIo
   interface. It's called to signal the udp TxToken when IpIo layer completes the
   transmitting of the udp datagram.
 
+  If Context is NULL, then ASSERT().
+  If NotifyData is NULL, then ASSERT().
+
   @param[in]  Status            The completion status of the output udp datagram.
   @param[in]  Context           Pointer to the context data.
   @param[in]  Sender            Specify a EFI_IP6_PROTOCOL for sending.
   @param[in]  NotifyData        Pointer to the notify data.
 
@@ -993,10 +1003,12 @@ Udp6DgramSent (
   )
 {
   UDP6_INSTANCE_DATA         *Instance;
   EFI_UDP6_COMPLETION_TOKEN  *Token;
 
+  ASSERT (Context != NULL && NotifyData != NULL);
+
   Instance = (UDP6_INSTANCE_DATA *) Context;
   Token    = (EFI_UDP6_COMPLETION_TOKEN *) NotifyData;
 
   if (Udp6RemoveToken (&Instance->TxTokens, Token) == EFI_SUCCESS) {
     //
@@ -1010,10 +1022,14 @@ Udp6DgramSent (
 
 
 /**
   This function processes the received datagram passed up by the IpIo layer.
 
+  If NetSession is NULL, then ASSERT().
+  If Packet is NULL, then ASSERT().
+  If Context is NULL, then ASSERT().
+
   @param[in]  Status            The status of this udp datagram.
   @param[in]  IcmpError         The IcmpError code, only available when Status is
                                 EFI_ICMP_ERROR.
   @param[in]  NetSession        Pointer to the EFI_NET_SESSION_DATA.
   @param[in]  Packet            Pointer to the NET_BUF containing the received udp
@@ -1029,10 +1045,11 @@ Udp6DgramRcvd (
   IN EFI_NET_SESSION_DATA  *NetSession,
   IN NET_BUF               *Packet,
   IN VOID                  *Context
   )
 {
+  ASSERT (NetSession != NULL && Packet != NULL && Context != NULL);
   NET_CHECK_SIGNATURE (Packet, NET_BUF_SIGNATURE);
 
   //
   // IpIo only passes received packets with Status EFI_SUCCESS or EFI_ICMP_ERROR.
   //
diff --git a/NetworkPkg/Udp6Dxe/Udp6Main.c b/NetworkPkg/Udp6Dxe/Udp6Main.c
index 53145c3..1d7f0ac 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Main.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Main.c
@@ -379,11 +379,11 @@ Udp6Groups (
   if (JoinFlag) {
 
     Status = NetMapInsertTail (&Instance->McastIps, (VOID *) McastIp, NULL);
   } else {
 
-    NetMapIterate (&Instance->McastIps, Udp6LeaveGroup, MulticastAddress);
+    Status = NetMapIterate (&Instance->McastIps, Udp6LeaveGroup, MulticastAddress);
   }
 
 ON_EXIT:
 
   gBS->RestoreTPL (OldTpl);
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Patch 0/4] Fix some issues in Udp6Dxe
  2018-01-04  3:20 [Patch 0/4] Fix some issues in Udp6Dxe fanwang2
                   ` (3 preceding siblings ...)
  2018-01-04  3:20 ` [Patch 4/4] NetworkPkg: Add more parameter or return status check " fanwang2
@ 2018-01-11  5:37 ` Wu, Jiaxin
  4 siblings, 0 replies; 6+ messages in thread
From: Wu, Jiaxin @ 2018-01-11  5:37 UTC (permalink / raw)
  To: Wang, Fan, edk2-devel@lists.01.org; +Cc: Wang, Fan

Series Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> fanwang2
> Sent: Thursday, January 4, 2018 11:20 AM
> To: edk2-devel@lists.01.org
> Cc: Wang, Fan <fan.wang@intel.com>
> Subject: [edk2] [Patch 0/4] Fix some issues in Udp6Dxe
> 
> From: Wang Fan <fan.wang@intel.com>
> 
> See descriptions in each patch.
> 
> Wang Fan (4):
>   NetworkPkg: Add ASSERT error handling for UDP6 driver
>   NetworkPkg: Fix a memory leak issue in UDP6 driver
>   NetworkPkg: Fix some coding style issues in UDP6 driver
>   NetworkPkg: Add more parameter or return status check in UDP6 driver
> 
>  NetworkPkg/Udp6Dxe/Udp6Driver.c | 68 ++++++++++++++++++++++-------
> ------------
>  NetworkPkg/Udp6Dxe/Udp6Impl.c   | 43 +++++++++++++++++++++++---
>  NetworkPkg/Udp6Dxe/Udp6Main.c   | 14 +++++++--
>  3 files changed, 86 insertions(+), 39 deletions(-)
> 
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-11  5:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04  3:20 [Patch 0/4] Fix some issues in Udp6Dxe fanwang2
2018-01-04  3:20 ` [Patch 1/4] NetworkPkg: Add ASSERT error handling for UDP6 driver fanwang2
2018-01-04  3:20 ` [Patch 2/4] NetworkPkg: Fix a memory leak issue in " fanwang2
2018-01-04  3:20 ` [Patch 3/4] NetworkPkg: Fix some coding style issues " fanwang2
2018-01-04  3:20 ` [Patch 4/4] NetworkPkg: Add more parameter or return status check " fanwang2
2018-01-11  5:37 ` [Patch 0/4] Fix some issues in Udp6Dxe Wu, Jiaxin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox