CoreInitializeGcdServices() takes a pointer-to-pointer for the first HOB. However, it is dereferenced in every operation inside. To mitigate confusion whether or not it can be re-allocated by the callee, remove the unnecessary indirection.
Cc: Jian J Wang <jian.j.w...@intel.com> Cc: Hao A Wu <hao.a...@intel.com> Cc: Dandan Bi <dandan...@intel.com> Cc: Liming Gao <gaolim...@byosoft.com.cn> Cc: Vitaly Cheptsov <vit9...@protonmail.com> Signed-off-by: Marvin Häuser <mhaeu...@posteo.de> --- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 2 +- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 10 +++++----- MdeModulePkg/Core/Dxe/DxeMain.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index db21311f9352..1a8f6b57f356 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -263,7 +263,7 @@ DxeMain ( // // Initialize Memory Services // - CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLength); + CoreInitializeMemoryServices (HobStart, &MemoryBaseAddress, &MemoryLength); MemoryProfileInit (HobStart); diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 51b082b7e7eb..af9e9e315819 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -2168,7 +2168,7 @@ FindLargestFreeRegion ( **/ EFI_STATUS CoreInitializeMemoryServices ( - IN VOID **HobStart, + IN VOID *HobStart, OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress, OUT UINT64 *MemoryLength ) @@ -2194,7 +2194,7 @@ CoreInitializeMemoryServices ( // // Point at the first HOB. This must be the PHIT HOB. // - Hob.Raw = *HobStart; + Hob.Raw = HobStart; ASSERT (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_HANDOFF); // @@ -2248,7 +2248,7 @@ CoreInitializeMemoryServices ( // Find the Resource Descriptor HOB that contains PHIT range EfiFreeMemoryBottom..EfiFreeMemoryTop // Found = FALSE; - for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { + for (Hob.Raw = HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { // // Skip all HOBs except Resource Descriptor HOBs // @@ -2304,7 +2304,7 @@ CoreInitializeMemoryServices ( // Compute range between the start of the Resource Descriptor HOB and the start of the HOB List // BaseAddress = PageAlignAddress (ResourceHob->PhysicalStart); - Length = PageAlignLength ((UINT64)((UINTN)*HobStart - BaseAddress)); + Length = PageAlignLength ((UINT64)((UINTN)HobStart - BaseAddress)); FindLargestFreeRegion (&BaseAddress, &Length, (EFI_HOB_MEMORY_ALLOCATION *)GetFirstHob (EFI_HOB_TYPE_MEMORY_ALLOCATION)); } } @@ -2329,7 +2329,7 @@ CoreInitializeMemoryServices ( // The max address must be within the physically addressible range for the processor. // HighAddress = MAX_ALLOC_ADDRESS; - for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { + for (Hob.Raw = HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { // // Skip the Resource Descriptor HOB that contains the PHIT // diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index 9bd3c0d08411..8f268dd2854a 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -366,7 +366,7 @@ CoreAcquireGcdMemoryLock ( **/ EFI_STATUS CoreInitializeMemoryServices ( - IN VOID **HobStart, + IN VOID *HobStart, OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress, OUT UINT64 *MemoryLength ); -- 2.31.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#78883): https://edk2.groups.io/g/devel/message/78883 Mute This Topic: https://groups.io/mt/84754056/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-