summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2016-07-12 17:39:43 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2016-07-18 10:55:23 +0800
commitc87bb070a6007605b13adc2f8f2b93086aed7956 (patch)
treed6e3add6f1ccfcf643decd385173bb9cf13092d6
parent107d05a433c3ea5d877baaa4867ede7708323d38 (diff)
downloadedk2-c87bb070a6007605b13adc2f8f2b93086aed7956.tar.gz
edk2-c87bb070a6007605b13adc2f8f2b93086aed7956.tar.bz2
edk2-c87bb070a6007605b13adc2f8f2b93086aed7956.zip
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>
-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)) {