MdeModulePkg/DxeIplPeim: Relocate operation of PageMapLevel5Entry++

This commit will fix a GCC 4.8.5 build failure introduced by commit
b3527dedc3.

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 <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
Zhang, Shenglei 2019-08-12 14:24:44 +08:00 committed by Hao A Wu
parent 073f2cede8
commit 46f8a68916
1 changed files with 2 additions and 1 deletions

View File

@ -764,7 +764,7 @@ CreateIdentityMappingPageTables (
for ( IndexOfPml5Entries = 0 for ( IndexOfPml5Entries = 0
; IndexOfPml5Entries < NumberOfPml5EntriesNeeded ; IndexOfPml5Entries < NumberOfPml5EntriesNeeded
; IndexOfPml5Entries++, PageMapLevel5Entry++) { ; IndexOfPml5Entries++) {
// //
// Each PML5 entry points to a page of PML4 entires. // Each PML5 entry points to a page of PML4 entires.
// So lets allocate space for them and fill them in in the IndexOfPml4Entries loop. // 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->Uint64 = (UINT64) (UINTN) PageMapLevel4Entry | AddressEncMask;
PageMapLevel5Entry->Bits.ReadWrite = 1; PageMapLevel5Entry->Bits.ReadWrite = 1;
PageMapLevel5Entry->Bits.Present = 1; PageMapLevel5Entry->Bits.Present = 1;
PageMapLevel5Entry++;
} }
for ( IndexOfPml4Entries = 0 for ( IndexOfPml4Entries = 0