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: 128792 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3331096ljc; Mon, 19 Feb 2018 02:15:38 -0800 (PST) X-Google-Smtp-Source: AH8x225g7/9piTg/vgzA/PhokGtURNZf9areQMfTg6j771K0J/y4c8H3BvvwTLTtXTpxp67yHJTP X-Received: by 2002:a17:902:7148:: with SMTP id u8-v6mr13314772plm.91.1519035338257; Mon, 19 Feb 2018 02:15:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519035338; cv=none; d=google.com; s=arc-20160816; b=uxA55e0lPi4miMIKb/j73ghSj50ItiMg25oXVmUcm1MZ3eOsqACi/Afl3NTj1tXtSO QiDY8M2EmUYODZCyw9j8rTzln2vNeoQkumnCky1TLuojgZh7cfldSKuiB9frXmpnQa9B okwEHjf9qEEtxpJ6oXUlNToy6NODCWmtETj7cPmCdSkP2lVmIhYO73WkhB2VDgCd/azr Vj40EJVTXU+FCxYNvuRtlaAeHZgcMAlNq2w8yAodPiVPHU+p3QDscuJx2u1C4TpFOmHM 9k7pb0n+BWhaRL6iurg4tJqjrmVxuYMVdgIpsCb8i44jCFBH9NYmHNmusVadEg013ioE eLIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=P/UfdSvPZ03bihsTdWgl5txTAPLLqklPc+B5niuZn0A=; b=AzAYzVcHDHg6hcWbPx4iuMt8oaaAm6/SziDBoPIuC1GpHWz42xx+gUpxSIx9bki+Ht MdsfftVupiq56JWkze9i2MQDHTKQbkh1I54dfgDeGEdPyISjuvFfKF0bVR93cX6Vtykx +GayacyHH06vdaaGEldxMc6og8QELTrgUEbUTNeVA5ySn+pQkXHDAFcPIgIQAMzVJV/X 7GVJS2M5CF8gewySJln2bg5kuUDD1qKH+o93VV7x0OJB8Ae30KgW/Ujxh1Yc07uvczYg 8WoHryiemomyQROLvPndFB9A+PvPbQ/XfhneXmdWCpmLYxNTNS0sPbvF99Ne8EKWetne 0faQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k1-v6si4736343plt.67.2018.02.19.02.15.37; Mon, 19 Feb 2018 02:15:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752688AbeBSKPe (ORCPT + 28 others); Mon, 19 Feb 2018 05:15:34 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:57593 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752244AbeBSKPa (ORCPT ); Mon, 19 Feb 2018 05:15:30 -0500 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 Cc: Greg KH , linux-kernel@vger.kernel.org, Arnd Bergmann , Will Deacon , Catalin Marinas , Ard Biesheuvel , Mark Rutland , linux-arm-kernel@lists.infradead.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== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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();