From patchwork Thu Nov 24 19:56:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Lloyd X-Patchwork-Id: 83987 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp222899qgi; Thu, 24 Nov 2016 11:56:23 -0800 (PST) X-Received: by 10.99.102.69 with SMTP id a66mr7066401pgc.49.1480017383078; Thu, 24 Nov 2016 11:56:23 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id i13si40700461pgp.325.2016.11.24.11.56.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2016 11:56:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B50E481EF1; Thu, 24 Nov 2016 11:56:22 -0800 (PST) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 717A781EF0 for ; Thu, 24 Nov 2016 11:56:20 -0800 (PST) Received: from E107800.Emea.Arm.com (e107800.emea.arm.com [10.1.35.78]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id uAOJuHJY021110; Thu, 24 Nov 2016 19:56:17 GMT From: evan.lloyd@arm.com To: edk2-devel@ml01.01.org Date: Thu, 24 Nov 2016 19:56:12 +0000 Message-Id: <20161124195612.17632-3-evan.lloyd@arm.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20161124195612.17632-1-evan.lloyd@arm.com> References: <20161124195612.17632-1-evan.lloyd@arm.com> Subject: [edk2] [PATCH 2/2] ArmPlatformPkg: Fix VE RTSM mem map descriptor count X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leif Lindholm , Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: Sami Mujawar 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 Signed-off-by: Evan Lloyd --- ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c index 14541183d1eb6916690823d7e04507fc50639f5f..14c7e8e1d6729f4ca91ef42520b1e5765d22b318 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMMem.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011-2014, ARM Limited. All rights reserved. +* Copyright (c) 2011-2016, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -21,7 +21,7 @@ #include // Number of Virtual Memory Map Descriptors -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 6 +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 8 // DDR attributes #define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK @@ -144,5 +144,6 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length = 0; VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0; + ASSERT (Index < MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); *VirtualMemoryMap = VirtualMemoryTable; }