Skip to content

Commit

Permalink
StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler wa…
Browse files Browse the repository at this point in the history
…rning

Assigning MmramRangeCount from MmCorePrivate (UINT64) to local variable
MmramRangeCount (UINT32) will cause compilation failure due to "warning
C4244: '=': conversion from 'UINT64' to 'UINT32', possible loss of data".
This changes defines local MmramRangeCount as UINTN type and adds type
cast before value assignment.

Cc: Ard Biesheuvel <[email protected]>
Cc: Sami Mujawar <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Supreeth Venkatesh <[email protected]>

Signed-off-by: Kun Qin <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
  • Loading branch information
kuqin12 committed Feb 1, 2021
1 parent f6c488b commit 2b90067
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ MemoryAllocationLibConstructor (
VOID *HobStart;
EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData;
EFI_MMRAM_DESCRIPTOR *MmramRanges;
UINT32 MmramRangeCount;
UINTN MmramRangeCount;
EFI_HOB_GUID_TYPE *MmramRangesHob;

HobStart = GetHobList ();
Expand All @@ -868,7 +868,7 @@ MemoryAllocationLibConstructor (
return EFI_UNSUPPORTED;
}

MmramRangeCount = MmramRangesHobData->NumberOfMmReservedRegions;
MmramRangeCount = (UINTN) MmramRangesHobData->NumberOfMmReservedRegions;
if (MmramRanges == NULL) {
return EFI_UNSUPPORTED;
}
Expand All @@ -877,7 +877,7 @@ MemoryAllocationLibConstructor (
DataInHob = GET_GUID_HOB_DATA (GuidHob);
MmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address;
MmramRanges = (EFI_MMRAM_DESCRIPTOR *)(UINTN)MmCorePrivate->MmramRanges;
MmramRangeCount = MmCorePrivate->MmramRangeCount;
MmramRangeCount = (UINTN) MmCorePrivate->MmramRangeCount;
}

{
Expand Down

0 comments on commit 2b90067

Please sign in to comment.