From patchwork Mon Feb 19 10:13:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10227393 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 C3982602B7 for ; Mon, 19 Feb 2018 10:15:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2A802896D for ; Mon, 19 Feb 2018 10:15:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A729E289C7; Mon, 19 Feb 2018 10:15:46 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 213692896D for ; Mon, 19 Feb 2018 10:15:46 +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:References: In-Reply-To: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:List-Owner; bh=CvP/h3tlLh241eM/RGZ8qLqlOylCTmI+itGTJua7WaU=; b=kahAZh3ptS5qv7+yjeyTHYAeqa MS+yw8n0oFJ5Z1Q6YTNs9ZOYM81ST+RcSwRM1BO2sRM6mZrWfDPEPSJTgQXIO+Few7EeXMMDyxQBS 31IP/FBskOTstNBZ867fqdU2O09VyU6IgYt+655GqKDQ2xLFKgMLcI4zTxC6/ve4gKLC5xKnvjZ7u +Y26RekZVXzzu5mpRj7j2/SHyLSS8AwK+rmD/TNVMlgLS3Q3dkatMPaVoFMEntlThKWl9hSQcmnfY AQc18sZy29e1kVnripJc8bm7RGrhCrLYlGmKFr4uCtOAs3oInpCGUNJJtdlHTzWIqOYCgnGq4NQ+M 4m4NjoAg==; 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 1eniTv-0004wy-C7; Mon, 19 Feb 2018 10:15:35 +0000 Received: from mout.kundenserver.de ([212.227.126.130]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eniTg-0003gP-EU for linux-arm-kernel@lists.infradead.org; Mon, 19 Feb 2018 10:15:28 +0000 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue006 [212.227.15.129]) with ESMTPA (Nemesis) id 0LuWiy-1eeoUS0A2y-00zpYU; Mon, 19 Feb 2018 11:15:04 +0100 From: Arnd Bergmann To: stable@vger.kernel.org Subject: [4.9-stable 7/9] arm64: fix warning about swapper_pg_dir overflow Date: Mon, 19 Feb 2018 11:13:26 +0100 Message-Id: <20180219101343.2922561-8-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180219101343.2922561-1-arnd@arndb.de> References: <20180219101343.2922561-1-arnd@arndb.de> X-Provags-ID: V03:K0:SAhe7T3IVieToXWBJGmlA4s3NSyYXUetj5yu1WjtIftver4eToN Gpk0Wl36N54ZJK797nhfl6b+k561922877V+bWEitopve3yGKBuJoc/M4vU/zKe0g4hn20I P8AGWyOYgKlOZa1eJeUsEMFrQJtLAMzR0p30f4nMxZTgp7d0PWqEEX8DwncqguNCJAHpy51 GJGOMvysaYv93OAHlgPOg== X-UI-Out-Filterresults: notjunk:1; V01:K0:HtneMOQWNCg=:3SwsiIrMSosazfd1sRbn1x 4+yqk6PI0GC0ueWnH1K0caqiukjBy5nk1ljaPYa9W2vPF8Wf3O95PGMOiHKOHnL5Bf2PmGUF2 WoKjfPZ4G9U9JPUZT/V3a9HuWI/fgqsTe2feEAz+pLq0/dRxgWyWPdV3cdpXBJLMRziMDxpYm 7luVv1KBfpHPU53R0LjOFHE7bw4e66KP5YcdXlNYm+QwHKOJ8aEodumtYLrIdY3tM1WuoktAm MLJG6UK5PtcwwgcfH0WT8zqZDwmKwChrjrxDG+YR2OW1r8w1vhEL10GKRszw1KOrbHqGMtK/S CzpGxPv/ZAh/7kYokaNzF/ej+g3nrNCSfZTGnmw4RTA51bOHY8PvPMzpyWd/LU+XqdH8CEsPf 1Uvu78uNcWTeG42d1vqus7SrzK9+ZpE9wVcpq9/Ytel6HfaVXdT8wKt4+v3tmwtGRkbqEP/n3 GLprks9WKqS5/4Ml11g7z1RcSfovW5ydrQi1uscIRi4PGOXZZU2gc6P+MBbfnc9N0+wxOKCyn /q3gKwwDC1M3O1X65P09zfyyEFzGcgeFpzKS+HsZG1FuYBhTdDXcDJH5LVo/IN/skBvQl55Cn MxU29RpJcMp5QOJQLatnIGrdDeGCjPluPqm9iZSHAM10tXCmj+NgiL+ckVr2aPyg3xES9dBUp gtDWwJvUjFK1p1I4XkjRutMbVxR7t4Te1CgtOQ1oozOOEyHHhBz7rceO6aY5lnSGdCXS/Y+e9 ILX5myZpi8BVD3OoAxeP3SrlGwzH0pwN7BdrAQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180219_021521_248689_6D310D82 X-CRM114-Status: GOOD ( 12.52 ) 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: Mark Rutland , Arnd Bergmann , Ard Biesheuvel , Greg KH , Will Deacon , linux-kernel@vger.kernel.org, Catalin Marinas , linux-arm-kernel@lists.infradead.org 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 commit 12f043ff2b28fa64c9123b454cbe30a8a9e1967e upstream. With 4 levels of 16KB pages, we get this warning about the fact that we are copying a whole page into an array that is declared as having only two pointers for the top level of the page table: arch/arm64/mm/mmu.c: In function 'paging_init': arch/arm64/mm/mmu.c:528:2: error: 'memcpy' writing 16384 bytes into a region of size 16 overflows the destination [-Werror=stringop-overflow=] This is harmless since we actually reserve a whole page in the definition of the array that comes from, and just the extern declaration is short. The pgdir is initialized to zero either way, so copying the actual entries here seems like the best solution. Acked-by: Ard Biesheuvel Acked-by: Mark Rutland Signed-off-by: Arnd Bergmann Signed-off-by: Will Deacon [slightly adapted to apply on 4.9] Signed-off-by: Arnd Bergmann --- arch/arm64/mm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 05615a3fdc6f..d5cc6d73c2c4 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -479,7 +479,7 @@ void __init paging_init(void) * To do this we need to go via a temporary pgd. */ cpu_replace_ttbr1(__va(pgd_phys)); - memcpy(swapper_pg_dir, pgd, PAGE_SIZE); + memcpy(swapper_pg_dir, pgd, PGD_SIZE); cpu_replace_ttbr1(swapper_pg_dir); pgd_clear_fixmap();