From patchwork Wed Dec 27 16:11:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Murzin X-Patchwork-Id: 10133775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E7D6A60318 for ; Wed, 27 Dec 2017 16:12:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0EAC2ACC1 for ; Wed, 27 Dec 2017 16:12:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C34C32B2CB; Wed, 27 Dec 2017 16:12:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 06F1A2ACC1 for ; Wed, 27 Dec 2017 16:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=FoglPhCw8fPNq6Dad0JnVogydJghUWhQgVgsTNg5uaE=; b=cet aMn0ObRra45G5ckBbpvvaWPm7FfHbs4DjR+1bjMOrXoDBRtIG7QDHfZ01z4t7qHqzJ+jvZStpRXB/ oA0EvDbxo81VD0GT8J3qMG29F2aEQTMzOmuGeFB/RVb2ZRwrASpBTZpN0hmHlSgWmnvfXF0Zz5ktg 7QyBc8/7X+RdYzuel3FCr7xM/9Z+G7zvXFctD26Gsb2H1+oQpBVOiyF4xaD2vRqLvnl5Ae1OZxaMI NTaLiB/QYQ0+bnsE+hnt//99tufWhVMkPdxH0pbZ/QYKQmgD5Xb59rGm0VIvCUj4v0ucKcKgc0cZx 4vWmbIn+QFhTIOSQiRcu4VXsoq2lKEw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eUEK2-0002dl-7x; Wed, 27 Dec 2017 16:12:50 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eUEJy-0002cT-A0 for linux-arm-kernel@lists.infradead.org; Wed, 27 Dec 2017 16:12:48 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ED58E1529; Wed, 27 Dec 2017 08:12:34 -0800 (PST) Received: from bc-c8-3-14.euhpc.arm.com. (bc-c8-3-14.euhpc.arm.com [10.6.6.206]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DBDFE3F318; Wed, 27 Dec 2017 08:12:33 -0800 (PST) From: Vladimir Murzin To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: NOMMU: Make sure we do not hold stale data in mem[] array Date: Wed, 27 Dec 2017 16:11:58 +0000 Message-Id: <1514391118-4877-1-git-send-email-vladimir.murzin@arm.com> X-Mailer: git-send-email 2.0.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171227_081246_352337_AF8AB3AC X-CRM114-Status: UNSURE ( 6.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux@armlinux.org.uk, kbuild-all@01.org, alexandre.torgue@st.com, sza@esh.hu MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP adjust_lowmem_bounds() called twice which can lead to stalled data (i.e. subreg) value in mem[] array after the first call. Zero out mem[] array before we allocate MPU regions for memory. Fixes: 5c9d9a1b3a54 ("ARM: 8712/1: NOMMU: Use more MPU regions to cover memory") Signed-off-by: Vladimir Murzin --- KernelVersion: 4.15-rc1 arch/arm/mm/pmsa-v7.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mm/pmsa-v7.c b/arch/arm/mm/pmsa-v7.c index 976df60..f65c01f 100644 --- a/arch/arm/mm/pmsa-v7.c +++ b/arch/arm/mm/pmsa-v7.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -296,6 +297,7 @@ void __init adjust_lowmem_bounds_mpu(void) } } + memset(mem, 0, sizeof(mem)); num = allocate_region(mem_start, specified_mem_size, mem_max_regions, mem); for (i = 0; i < num; i++) {