]> xenbits.xensource.com Git - people/aperard/ovmf.git/commitdiff
MdeModulePkg/DxeIplPeim: Relocate operation of PageMapLevel5Entry++
authorZhang, Shenglei <shenglei.zhang@intel.com>
Mon, 12 Aug 2019 06:24:44 +0000 (14:24 +0800)
committerHao A Wu <hao.a.wu@intel.com>
Wed, 14 Aug 2019 01:04:04 +0000 (09:04 +0800)
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 <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>
MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c

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