]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: Fix VE RTSM mem map descriptor count
authorSami Mujawar <sami.mujawar@arm.com>
Thu, 24 Nov 2016 19:56:12 +0000 (19:56 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 25 Nov 2016 14:03:32 +0000 (14:03 +0000)
The number of memory map entries used exceeded the allocated count,
thereby causing memory corruption.

Fixed the number of Virtual Memory Map Descriptors allocated in
describing the RTSM Memory Map. Also added an assert to confirm
that the descriptor count has not been exceeded, in the hope that it may
help highlight the problem should a new entry be added.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c

index 14541183d1eb6916690823d7e04507fc50639f5f..14c7e8e1d6729f4ca91ef42520b1e5765d22b318 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2016, ARM Limited. All rights reserved.\r
 *\r
 *  This program and the accompanying materials\r
 *  are licensed and made available under the terms and conditions of the BSD License\r
@@ -21,7 +21,7 @@
 #include <ArmPlatform.h>\r
 \r
 // Number of Virtual Memory Map Descriptors\r
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          6\r
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          8\r
 \r
 // DDR attributes\r
 #define DDR_ATTRIBUTES_CACHED   ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK\r
@@ -144,5 +144,6 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryTable[Index].Length = 0;\r
   VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;\r
 \r
+  ASSERT (Index < MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);\r
   *VirtualMemoryMap = VirtualMemoryTable;\r
 }\r