When LinearAddress or Length is not aligned on 4KB, PageTableMap() should return Invalid Parameter.
Signed-off-by: Zhiguang Liu <zhiguang....@intel.com> Reviewed-by: Ray Ni <ray...@intel.com> Cc: Eric Dong <eric.d...@intel.com> --- UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c index 25e13a6f6f..17bca5e351 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; } -- 2.35.1.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#91450): https://edk2.groups.io/g/devel/message/91450 Mute This Topic: https://groups.io/mt/92458155/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-