audk/MdeModulePkg
Ard Biesheuvel 54d81d06fc MdeModulePkg/DxeCore: Use correct type for alignment mask
The page allocator code in CoreFindFreePagesI() uses a mask derived from
its UINTN Alignment argument to align the descriptor end address of a
MEMORY_MAP entry to the requested alignment, in order to check whether
the descriptor covers enough sufficiently aligned area to satisfy the
request.

However, on 32-bit architectures, 'Alignment' is a 32-bit type, whereas
DescEnd is a 64-bit type, and so the resulting operation performed on
the end address comes down to masking with 0xfffff000 instead of the
intended 0xffffffff_fffff000. Given the -1 at the end of the expression,
the resulting address is 0xffffffff_fffffffff for any descriptor that
ends on a 4G aligned boundary, and this is certainly not what was
intended.

So cast Alignment to UINT64 to ensure that the mask has the right size.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2022-12-08 18:09:48 +00:00
..
Application MdeModulePkg/DumpDynPcd: Remove unsupported format specifiers 2022-08-17 07:45:58 +00:00
Bus MdeModulePkg: Put USB DEBUGs that occur for bulk timeouts under VERBOSE 2022-12-08 02:58:24 +00:00
Core MdeModulePkg/DxeCore: Use correct type for alignment mask 2022-12-08 18:09:48 +00:00
Include MdePkg: Add UEFI Unaccepted memory definition 2022-11-01 10:08:10 +00:00
Library MdeModulePkg/UefiBootManagerLib: Add Disk Info support for Ufs 2022-10-06 17:38:41 +00:00
Logo MdeModulePkg/Logo: Add LoongArch64 architecture. 2022-10-14 02:16:33 +00:00
Test MdeModulePkg/UefiSortLib:Add UefiSortLib unit test 2021-08-12 08:34:04 +00:00
Universal MdeModulePkg/CapsuleRuntimeDxe: Add LoongArch64 architecture. 2022-10-14 02:16:33 +00:00
MdeModulePkg.ci.yaml MdeModulePkg: Update YAML to ignore specific ECC files/errors 2021-11-30 14:19:07 +00:00
MdeModulePkg.dec MdeModulePkg: Disable PciDegrade support for LoongArch64 2022-12-01 02:52:14 +00:00
MdeModulePkg.dsc MdeModulePkg: Use LockBoxNullLib for LOONGARCH64 2022-10-14 02:16:33 +00:00
MdeModulePkg.uni MdeModulePkg: Use configurable PCD for AHCI command retries 2022-09-13 02:51:27 +00:00
MdeModulePkgExtra.uni MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00