Revision: 18422
          http://sourceforge.net/p/edk2/code/18422
Author:   abiesheuvel
Date:     2015-09-09 13:37:22 +0000 (Wed, 09 Sep 2015)
Log Message:
-----------
ArmPkg/Mmu: Fix page level calculation bug

The bug can be triggered when alignment of Base is larger than Length
by 2 level of page granularity, e.g.

Base is 0x4000_0000, Length is 0x1000

The original code will change 2MB page level and we will get a
negative remaining length.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <[email protected]>
Cc: Leif Lindholm <[email protected]>
Reviewed-by: Ard Biesheuvel <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c

Modified: trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c
===================================================================
--- trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c       2015-09-09 
13:37:13 UTC (rev 18421)
+++ trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c       2015-09-09 
13:37:22 UTC (rev 18422)
@@ -314,7 +314,7 @@
   // If the required size is smaller than the current block size then we need 
to go to the page below.
   // The PageLevel was calculated on the Base Address alignment but did not 
take in account the alignment
   // of the allocation size
-  if (*BlockEntrySize < TT_BLOCK_ENTRY_SIZE_AT_LEVEL (PageLevel)) {
+  while (*BlockEntrySize < TT_BLOCK_ENTRY_SIZE_AT_LEVEL (PageLevel)) {
     // It does not fit so we need to go a page level above
     PageLevel++;
   }


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to