MdeModulePkg/PiSmmCore: add API parameter check

The Heap Guard feature wrapped SmmInternalFreePagesEx with
SmmInternalFreePagesExWithGuard but didn't add necessary
parameter check. This patch fixes this situation.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Jian J Wang 2018-02-06 13:12:36 +08:00 committed by Ruiyu Ni
parent a012bf6e3e
commit 7823611cda
1 changed files with 4 additions and 0 deletions

View File

@ -1205,6 +1205,10 @@ SmmInternalFreePagesExWithGuard (
EFI_PHYSICAL_ADDRESS MemoryToFree;
UINTN PagesToFree;
if (((Memory & EFI_PAGE_MASK) != 0) || (Memory == 0) || (NumberOfPages == 0)) {
return EFI_INVALID_PARAMETER;
}
MemoryToFree = Memory;
PagesToFree = NumberOfPages;