From dcf2e39dce00a5978f1c1a53a0fce04d0fdc9a3c Mon Sep 17 00:00:00 2001 From: Jayaprakash N Date: Tue, 6 Feb 2024 08:19:31 -0800 Subject: [PATCH] EmbeddedPkg: compiler error due to arithmetic operation on void pointer REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4668 This commit fixes the issue reported in the BZ4668. The EmbeddedPkg fails to compile with a compiler error generated due to invalid/illegal arithmetic operation on void pointers. It has been fixed by using explicit type conversion of the void pointer to UINTN. Cc: Rebecca Cran Cc: Michael D Kinney Cc: Laszlo Ersek Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Abner Chang Cc: Jayaprakash N Signed-off-by: Jayaprakash N Reviewed-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Acked-by: Michael D Kinney --- .../Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c index fa81cc9d59..f4077c04a7 100644 --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c @@ -308,7 +308,7 @@ ReallocatePool ( if (OldBuffer != NULL) { HandOffHob = GetHobList (); ASSERT (((EFI_PHYSICAL_ADDRESS)(UINTN)OldBuffer >= HandOffHob->EfiMemoryBottom)); - ASSERT (((EFI_PHYSICAL_ADDRESS)(UINTN)(OldBuffer + OldSize) <= HandOffHob->EfiFreeMemoryBottom)); + ASSERT (((EFI_PHYSICAL_ADDRESS)((UINTN)OldBuffer + OldSize) <= HandOffHob->EfiFreeMemoryBottom)); } DEBUG_CODE_END ();