UefiCpuPkg/CpuPageTableLib: Return error on invalid parameters

When LinearAddress or Length is not aligned on 4KB, PageTableMap()
should return Invalid Parameter.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
Ray Ni 2022-07-14 15:36:09 +08:00 committed by mergify[bot]
parent 75e3c2435c
commit f336e30ba1
1 changed files with 7 additions and 0 deletions

View File

@ -467,6 +467,13 @@ PageTableMap (
return RETURN_INVALID_PARAMETER;
}
if ((LinearAddress % SIZE_4KB != 0) || (Length % SIZE_4KB != 0)) {
//
// LinearAddress and Length should be multiple of 4K.
//
return RETURN_INVALID_PARAMETER;
}
if ((*BufferSize != 0) && (Buffer == NULL)) {
return RETURN_INVALID_PARAMETER;
}