From 2bcc3cbd7ffeac7d3a05c4bdf3d8b1866be4f08c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20Ha=CC=88user?= <8659494+mhaeuser@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:29:20 +0200 Subject: [PATCH] User/BaseMemoryLib: Fix aligned page alloc --- User/Library/UserBaseMemoryLib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/User/Library/UserBaseMemoryLib.c b/User/Library/UserBaseMemoryLib.c index f32ce160..78ad983a 100644 --- a/User/Library/UserBaseMemoryLib.c +++ b/User/Library/UserBaseMemoryLib.c @@ -231,6 +231,10 @@ InternalAllocatePagesAlign ( // Check that we have not gone beyond the single allocation size limit // if (RequestedAllocationSize <= mPoolAllocationSizeLimit) { + if (Alignment < EFI_PAGE_SIZE) { + Alignment = EFI_PAGE_SIZE; + } + #ifdef _WIN32 Buffer = _aligned_malloc (RequestedAllocationSize, Alignment); #else // !_WIN32