]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SourceLevelDebugPkg: DebugCommunicationLibUsb3: Update local variable type.
authorEric Dong <eric.dong@intel.com>
Mon, 25 Jan 2016 03:33:45 +0000 (03:33 +0000)
committerydong10 <ydong10@Edk2>
Mon, 25 Jan 2016 03:33:45 +0000 (03:33 +0000)
Update the local variable type to avoid potential data overflow.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Hao Wu <hao.wu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19734 6f19259b-4bc3-4df7-8a09-765794883524

SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c

index c232323df878d14c559359e4370a85e065841264..c4a8a476829957b5e16c741f31db96e5ecf5cdd8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Debug Port Library implementation based on usb3 debug port.\r
 \r
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -30,18 +30,23 @@ AllocateAlignBuffer (
   IN UINTN                    BufferSize\r
   )\r
 {\r
-  VOID      *Buf;\r
+  EFI_PHYSICAL_ADDRESS    TmpAddr;\r
+  EFI_STATUS              Status;\r
+  VOID                    *Buf;\r
   \r
   Buf = NULL;\r
   \r
   if (gBS != NULL) {\r
-    Buf = (VOID *)(UINTN)0xFFFFFFFF;\r
-    gBS->AllocatePages (\r
-           AllocateMaxAddress,\r
-           EfiACPIMemoryNVS,\r
-           EFI_SIZE_TO_PAGES (BufferSize),\r
-           (EFI_PHYSICAL_ADDRESS *) &Buf\r
-           );\r
+    TmpAddr = 0xFFFFFFFF;\r
+    Status = gBS->AllocatePages (\r
+               AllocateMaxAddress,\r
+               EfiACPIMemoryNVS,\r
+               EFI_SIZE_TO_PAGES (BufferSize),\r
+               &TmpAddr\r
+               );\r
+    if (!EFI_ERROR (Status)) {\r
+      Buf = (VOID *) (UINTN) TmpAddr;\r
+    }\r
   }\r
 \r
   return Buf;\r