summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2016-07-12 17:39:43 +0800
committerHao Wu <hao.a.wu@intel.com>2016-07-25 11:04:24 +0800
commitedc956244162245bbba365f11209a3efa35ab99c (patch)
tree01d525d0e5d260a7e3cca0baed0acb5eff4a1a4f /ShellPkg
parent70e2efa3165936af5c84f28e914615b5b09bfd8b (diff)
downloadedk2-platforms-edc956244162245bbba365f11209a3efa35ab99c.tar.xz
ShellPkg/DMem: Handle memory allocation failure
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit c87bb070a6007605b13adc2f8f2b93086aed7956)
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c
index 7693835b88..5491f6de57 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c
@@ -1,7 +1,7 @@
/** @file
Main file for Dmem shell Debug1 function.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
@@ -68,7 +68,9 @@ DisplayMmioMemory(
return (SHELL_NOT_FOUND);
}
Buffer = AllocateZeroPool(Size);
- ASSERT(Buffer != NULL);
+ if (Buffer == NULL) {
+ return SHELL_OUT_OF_RESOURCES;
+ }
Status = PciRbIo->Mem.Read(PciRbIo, EfiPciWidthUint8, (UINT64)(UINTN)Address, Size, Buffer);
if (EFI_ERROR(Status)) {