summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg
diff options
context:
space:
mode:
authorRay Ni <ray.ni@intel.com>2022-07-14 15:36:09 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-08-09 07:08:05 +0000
commitf336e30ba14f182836919a7662134ac28ded983a (patch)
treeb3d74439c6d2cd38215bbfb63734adedbd78dfdf /UefiCpuPkg
parent75e3c2435c7f10675d075ae7e5d4e9dea7331bcf (diff)
downloadedk2-f336e30ba14f182836919a7662134ac28ded983a.tar.gz
edk2-f336e30ba14f182836919a7662134ac28ded983a.tar.bz2
edk2-f336e30ba14f182836919a7662134ac28ded983a.zip
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>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r--UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
index f75c6657ad..a0e1309462 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
@@ -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;
}