From 46f8a6891606746ca8b1e684ac379ce271306dc0 Mon Sep 17 00:00:00 2001 From: "Zhang, Shenglei" Date: Mon, 12 Aug 2019 14:24:44 +0800 Subject: MdeModulePkg/DxeIplPeim: Relocate operation of PageMapLevel5Entry++ This commit will fix a GCC 4.8.5 build failure introduced by commit b3527dedc3951f061c5a73cb4fb2b0f95f47e08b. PageMapLevel5Entry may be uninitialized in original code, which means uninitialized pointer will be modified at some circumstance. So relocate the operation of PageMapLevel5Entry++ in order to make sure the pointer could be modified only when it is initialized. Cc: Liming Gao Signed-off-by: Shenglei Zhang Reviewed-by: Hao A Wu Reviewed-by: Dandan Bi Reviewed-by: Eric Dong --- MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c index b40b7e0c98..2389f3eb48 100644 --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c @@ -764,7 +764,7 @@ CreateIdentityMappingPageTables ( for ( IndexOfPml5Entries = 0 ; IndexOfPml5Entries < NumberOfPml5EntriesNeeded - ; IndexOfPml5Entries++, PageMapLevel5Entry++) { + ; IndexOfPml5Entries++) { // // Each PML5 entry points to a page of PML4 entires. // So lets allocate space for them and fill them in in the IndexOfPml4Entries loop. @@ -780,6 +780,7 @@ CreateIdentityMappingPageTables ( PageMapLevel5Entry->Uint64 = (UINT64) (UINTN) PageMapLevel4Entry | AddressEncMask; PageMapLevel5Entry->Bits.ReadWrite = 1; PageMapLevel5Entry->Bits.Present = 1; + PageMapLevel5Entry++; } for ( IndexOfPml4Entries = 0 -- cgit v1.2.3