/** @file\r
Udp6 driver's whole implementation.\r
\r
- Copyright (c) 2009 - 2016 Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
interface. It's called to signal the udp TxToken when the IpIo layer completes\r
transmitting of the udp datagram.\r
\r
+ If Context is NULL, then ASSERT().\r
+ If NotifyData is NULL, then ASSERT().\r
+\r
@param[in] Status The completion status of the output udp datagram.\r
@param[in] Context Pointer to the context data.\r
@param[in] Sender Specify a EFI_IP6_PROTOCOL for sending.\r
/**\r
This function processes the received datagram passed up by the IpIo layer.\r
\r
+ If NetSession is NULL, then ASSERT().\r
+ If Packet is NULL, then ASSERT().\r
+ If Context is NULL, then ASSERT().\r
+\r
@param[in] Status The status of this udp datagram.\r
@param[in] IcmpError The IcmpError code, only available when Status is\r
EFI_ICMP_ERROR.\r
@param[in] RxData Pointer to the EFI_UDP6_RECEIVE_DATA of this\r
datagram.\r
\r
- @return Pointer to the structure wrapping the RxData and the Packet.\r
+ @return Pointer to the structure wrapping the RxData and the Packet. NULL will\r
+ be returned if any error occurs.\r
\r
**/\r
UDP6_RXDATA_WRAP *\r
interface. It's called to signal the udp TxToken when IpIo layer completes the\r
transmitting of the udp datagram.\r
\r
+ If Context is NULL, then ASSERT().\r
+ If NotifyData is NULL, then ASSERT().\r
+\r
@param[in] Status The completion status of the output udp datagram.\r
@param[in] Context Pointer to the context data.\r
@param[in] Sender Specify a EFI_IP6_PROTOCOL for sending.\r
UDP6_INSTANCE_DATA *Instance;\r
EFI_UDP6_COMPLETION_TOKEN *Token;\r
\r
+ ASSERT (Context != NULL && NotifyData != NULL);\r
+\r
Instance = (UDP6_INSTANCE_DATA *) Context;\r
Token = (EFI_UDP6_COMPLETION_TOKEN *) NotifyData;\r
\r
/**\r
This function processes the received datagram passed up by the IpIo layer.\r
\r
+ If NetSession is NULL, then ASSERT().\r
+ If Packet is NULL, then ASSERT().\r
+ If Context is NULL, then ASSERT().\r
+\r
@param[in] Status The status of this udp datagram.\r
@param[in] IcmpError The IcmpError code, only available when Status is\r
EFI_ICMP_ERROR.\r
IN VOID *Context\r
)\r
{\r
+ ASSERT (NetSession != NULL && Packet != NULL && Context != NULL);\r
NET_CHECK_SIGNATURE (Packet, NET_BUF_SIGNATURE);\r
\r
//\r
@param[in] RxData Pointer to the EFI_UDP6_RECEIVE_DATA of this\r
datagram.\r
\r
- @return Pointer to the structure wrapping the RxData and the Packet.\r
+ @return Pointer to the structure wrapping the RxData and the Packet. NULL will\r
+ be returned if any error occurs.\r
\r
**/\r
UDP6_RXDATA_WRAP *\r
EFI_UDP6_SESSION_DATA *Udp6Session;\r
UINTN Enqueued;\r
\r
- if (Packet->TotalSize < sizeof (EFI_UDP_HEADER)) {\r
+ if (Packet->TotalSize < UDP6_HEADER_SIZE) {\r
NetbufFree (Packet);\r
return;\r
}\r
//\r
Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);\r
ASSERT (Udp6Header != NULL);\r
+ if (Udp6Header == NULL) {\r
+ NetbufFree (Packet);\r
+ return;\r
+ }\r
\r
if (Udp6Header->Checksum != 0) {\r
//\r
//\r
Ip6ModeData = AllocateZeroPool (sizeof (EFI_IP6_MODE_DATA));\r
ASSERT (Ip6ModeData != NULL);\r
+ if (Ip6ModeData == NULL) {\r
+ goto EXIT;\r
+ }\r
\r
//\r
// If not finding the related IpSender use the default IpIo to send out\r
//\r
IcmpErrHdr = (IP6_ICMP_ERROR_HEAD *) NetbufAllocSpace (Packet, Len, FALSE);\r
ASSERT (IcmpErrHdr != NULL);\r
+ if (IcmpErrHdr == NULL) {\r
+ goto EXIT;\r
+ }\r
\r
//\r
// Set the required fields for the icmp port unreachable message.\r
LIST_ENTRY *Entry;\r
UDP6_INSTANCE_DATA *Instance;\r
\r
- if (Packet->TotalSize < sizeof (EFI_UDP_HEADER)) {\r
+ if (Packet->TotalSize < UDP6_HEADER_SIZE) {\r
NetbufFree (Packet);\r
return;\r
}\r
\r
Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);\r
ASSERT (Udp6Header != NULL);\r
+ if (Udp6Header == NULL) {\r
+ NetbufFree (Packet);\r
+ return;\r
+ }\r
\r
IP6_COPY_ADDRESS (&Udp6Session.SourceAddress, &NetSession->Source);\r
IP6_COPY_ADDRESS (&Udp6Session.DestinationAddress, &NetSession->Dest);\r