Skip to content

Commit fb48ef2

Browse files
ardbiesheuvelmakubacki
authored andcommitted
[CHERRY-PICK] MdeModulePkg: Remove ambiguous negation of narrower type
Replace UINTN casts with EFI_PHYSICAL_ADDRESS in places where the result is negated, as otherwise, the top bits may remain 0 unexpectedly. VS2022 started warning about this, and thus breaking the IA32 CI build. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> (cherry picked from commit bd4bb10)
1 parent 7a13281 commit fb48ef2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

MdeModulePkg/Core/Dxe/Image/Image.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ CoreLoadPeImage (
790790
if (!Image->ImageContext.IsTeImage) {
791791
Image->ImageContext.ImageAddress =
792792
(Image->ImageContext.ImageAddress + Image->ImageContext.SectionAlignment - 1) &
793-
~((UINTN)Image->ImageContext.SectionAlignment - 1);
793+
~((EFI_PHYSICAL_ADDRESS)Image->ImageContext.SectionAlignment - 1);
794794
}
795795

796796
//

MdeModulePkg/Core/Pei/Image/Image.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ LoadAndRelocatePeCoffImage (
402402
if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
403403
ImageContext.ImageAddress =
404404
(ImageContext.ImageAddress + ImageContext.SectionAlignment - 1) &
405-
~((UINTN)ImageContext.SectionAlignment - 1);
405+
~((EFI_PHYSICAL_ADDRESS)ImageContext.SectionAlignment - 1);
406406
}
407407

408408
//

0 commit comments

Comments
 (0)