Hi Eric,

The patch is good to me.
Reviewed-by: Hao Wu <hao.a...@intel.com>

Best Regards,
Hao Wu

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Eric Dong
> Sent: Wednesday, January 20, 2016 1:04 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng
> Subject: [edk2] [Patch] Update local variable type to avoid potential data
> overflow.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Eric Dong <eric.d...@intel.com>
> Cc: Feng Tian <feng.t...@intel.com>
> ---
>  .../DebugCommunicationLibUsb3Dxe.c                 | 23 
> +++++++++++++---------
>  1 file changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git
> a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom
> municationLibUsb3Dxe.c
> b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom
> municationLibUsb3Dxe.c
> index c232323..c4a8a47 100644
> ---
> a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom
> municationLibUsb3Dxe.c
> +++
> b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom
> municationLibUsb3Dxe.c
> @@ -1,9 +1,9 @@
>  /** @file
>    Debug Port Library implementation based on usb3 debug port.
> 
> -  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2014 - 2016, 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.
> 
> @@ -28,21 +28,26 @@
>  VOID*
>  AllocateAlignBuffer (
>    IN UINTN                    BufferSize
>    )
>  {
> -  VOID      *Buf;
> +  EFI_PHYSICAL_ADDRESS    TmpAddr;
> +  EFI_STATUS              Status;
> +  VOID                    *Buf;
> 
>    Buf = NULL;
> 
>    if (gBS != NULL) {
> -    Buf = (VOID *)(UINTN)0xFFFFFFFF;
> -    gBS->AllocatePages (
> -           AllocateMaxAddress,
> -           EfiACPIMemoryNVS,
> -           EFI_SIZE_TO_PAGES (BufferSize),
> -           (EFI_PHYSICAL_ADDRESS *) &Buf
> -           );
> +    TmpAddr = 0xFFFFFFFF;
> +    Status = gBS->AllocatePages (
> +               AllocateMaxAddress,
> +               EfiACPIMemoryNVS,
> +               EFI_SIZE_TO_PAGES (BufferSize),
> +               &TmpAddr
> +               );
> +    if (!EFI_ERROR (Status)) {
> +      Buf = (VOID *) (UINTN) TmpAddr;
> +    }
>    }
> 
>    return Buf;
>  }
> --
> 2.6.4.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to