Reviewed-By: Wu Jiaxin <[email protected]>

Best Regards!
Jiaxin

> -----Original Message-----
> From: Zhang, Lubo
> Sent: Thursday, October 27, 2016 3:41 PM
> To: [email protected]
> Cc: Fu, Siyuan <[email protected]>; Wu, Jiaxin <[email protected]>
> Subject: [patch] NetworkPkg: Add error handling logic when using
> AllocateZeorPool
> 
> Add error handling logic if failed to apply new memory.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo <[email protected]>
> Cc: Fu Siyuan <[email protected]>
> Cc: Wu Jiaxin <[email protected]>
> ---
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
> b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
> index 45377e3..eba8e1d 100644
> --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
> +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
> @@ -1296,12 +1296,13 @@ PxeBcSelectDhcp6Offer (
>  /**
>    Handle the DHCPv6 offer packet.
> 
>    @param[in]  Private             The pointer to PXEBC_PRIVATE_DATA.
> 
> -  @retval     EFI_SUCCESS         Handled the DHCPv6 offer packet 
> successfully.
> -  @retval     EFI_NO_RESPONSE     No response to the following request 
> packet.
> +  @retval     EFI_SUCCESS           Handled the DHCPv6 offer packet 
> successfully.
> +  @retval     EFI_NO_RESPONSE       No response to the following request
> packet.
> +  @retval     EFI_OUT_OF_RESOURCES  Failed to allocate resources.
> 
>  **/
>  EFI_STATUS
>  PxeBcHandleDhcp6Offer (
>    IN PXEBC_PRIVATE_DATA            *Private
> @@ -1323,10 +1324,13 @@ PxeBcHandleDhcp6Offer (
>    //
>    // First try to cache DNS server address if DHCP6 offer provides.
>    //
>    if (Cache6->OptList[PXEBC_DHCP6_IDX_DNS_SERVER] != NULL) {
>      Private->DnsServer = AllocateZeroPool (NTOHS (Cache6-
> >OptList[PXEBC_DHCP6_IDX_DNS_SERVER]->OpLen));
> +    if (Private->DnsServer == NULL) {
> +      return EFI_OUT_OF_RESOURCES;
> +    }
>      CopyMem (Private->DnsServer, Cache6-
> >OptList[PXEBC_DHCP6_IDX_DNS_SERVER]->Data, sizeof (EFI_IPv6_ADDRESS));
>    }
> 
>    if (Cache6->OfferType == PxeOfferTypeDhcpBinl) {
>      //
> --
> 1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to