summaryrefslogtreecommitdiff
path: root/SourceLevelDebugPkg
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2016-01-25 03:33:45 +0000
committerydong10 <ydong10@Edk2>2016-01-25 03:33:45 +0000
commit95055567a626f5d55d46a42fc4c7198a80389467 (patch)
tree95b46a1d746a475c981ab71db92900858251fb2e /SourceLevelDebugPkg
parent0179180d6dbacc1bed53c3b6a886693790f75365 (diff)
downloadedk2-platforms-95055567a626f5d55d46a42fc4c7198a80389467.tar.xz
SourceLevelDebugPkg: DebugCommunicationLibUsb3: Update local variable type.
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
Diffstat (limited to 'SourceLevelDebugPkg')
-rw-r--r--SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c
index c232323df8..c4a8a47682 100644
--- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c
+++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c
@@ -1,7 +1,7 @@
/** @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
@@ -30,18 +30,23 @@ 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;