From patchwork Thu Feb 22 10:40:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 129192 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp450888lja; Thu, 22 Feb 2018 02:42:23 -0800 (PST) X-Google-Smtp-Source: AH8x2260XHr+zTFAvt9bkWt8UsyVkq+Sf8pUnq7/bDDbbu7usjrg9zcQpaLBFQaDhMu5djnsErOF X-Received: by 2002:a17:902:8a98:: with SMTP id p24-v6mr6103514plo.147.1519296143664; Thu, 22 Feb 2018 02:42:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519296143; cv=none; d=google.com; s=arc-20160816; b=BVWqgk84Jn3usufgk5sX/Dab/NRuSME9ryi3oA6rtb2dqsR8c98O/H4wYuj5OjO1gd d8Ie3HvMtnYIrXZoK7yvXlMwl4AUtmEBQKRBZaBNUIxKZP0dq14mTCjaQ6jbGzsAMfWn O6WCUwiPfpPqF6i5WVQtSn0DOXiw1uUTOrvS1qY7oIvuOLQszFSgeZSwWg+jIr8Zl0RF MZse847+zZP+IzqDGzAv0v4OPhU5PnMlYjCle7hJRAjFiFL+v5wRoCdtA7Go8BccZMVw vfuJGJ5+HAH0dcdS9XPhxYjRw4ZWAXW66UtmlHhDyfelRKv3SvFNksvsYttgYwX/OZTJ NIDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=UFjHjCqwOmbFSJkJ3mV8nWW2sLggVnQLZSnO9envHy8=; b=WRXMSdRKMkv/e3/wQnuyKOFGH/KXxoFQMQwB7KsONFw94oXS0SxMyGNtnmyelcllHE wV2c95eN/mHfjfEWLEnzNH0xDkZUlRiruwOpoK03UdwYDh9rMbyJ/UWDiAfyiHZ5bGGG LyRdbHnuDiFF1BHOwSJNR19yDqnfFfRKqG+Xny+hHAW3zRzlmVao3wcsCIejOYuzyr66 f+X1tH/2YQkk6SOicjXi8fhIxxEQ9lH+CHoDbOU3Jz5bh9n9MnKEkHOJnMLYmE75guXQ c/2s6JF2pzTjB9I06k4N/v6tvT+XpoqAxxbnm7sM2/pBJUuz3azEYdXSbDqlfpEet34t Kc4A== 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 p3-v6si1074410plo.99.2018.02.22.02.42.23; Thu, 22 Feb 2018 02:42:23 -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 S1753545AbeBVKmU (ORCPT + 28 others); Thu, 22 Feb 2018 05:42:20 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:53549 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753288AbeBVKmP (ORCPT ); Thu, 22 Feb 2018 05:42:15 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0LiJAx-1eSPrv2BAh-00nUCK; Thu, 22 Feb 2018 11:41:04 +0100 From: Arnd Bergmann To: Thomas Gleixner , Ingo Molnar , x86@kernel.org, "Kirill A. Shutemov" Cc: Arnd Bergmann , Martin Sebor , "H. Peter Anvin" , linux-kernel@vger.kernel.org Subject: [PATCH] x86/boot/compressed/64: fix warning for 32-bit trampoline copy Date: Thu, 22 Feb 2018 11:40:41 +0100 Message-Id: <20180222104101.2717185-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:nwtsDGuwVnHQeaBF/rZl7gABQXzM1b2vJfMPiRgofzqW0w2rzog sP+IswSU3DF1RKjGW+iBbAAXIRqGSQywqClDFAPvMeUhLxSWQnL5CIZC4Qb1HFeLLIEZ329 djeM0KGJtg/ew5+0b1Kg2oRblPL+H0ar9jU3CmK2nmKC+mFWMrmMb3fwP0mPjeXqJNxfk/5 i33n5urDquFH1qgqDuB1Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:T87I09TTYPE=:LwXMmkJMCYjpml/buLxBQ9 YORWeLt2BSOJzptMII65IdK/ULCitgbKmN3mmXuseP4A7DXIhu9M3JGBbVJ3347BsOUBcv3eB uJ1fb6n8CEG0AXwU7NUYILeSOFKAI4M/pQCB7DgjOA7m2d4Q1BVmPzSI1iX94e8aS19d3DqJ+ HG0Mg1P/yrHUL81tdqYSVAONR/3zMKV3fbzLzUgQboJZ/SJy4UCG2qGhDk5VvCfSbbHHBhBG5 +Xn6mXmbmajKTqvd5ZtlnCn6bLWN50qOwEjmAUXDZ9/eOatSkVH5YLW0oC8tbeoCSpcbgND1a 5W9lMJ2EHVAT6HboTmvZVnV/cijz978YmFT60lUQuzPvmyon6JBjpxx1A/CyHlPfi8I7LjABm gJ3jOASM4tjNg9YMLuJEGq21QVI8peUoQ58cOMtpj+ullklM/EKR1HDLDz+7JdA3BEQLHg74/ wAgk7KchtMFQyQWyFNZFpoLrJh9AUgxyZkmlPZcsILNM34HnbiJNQsidDkk7oAy/mpJQl2sQ3 bzFZbf5icKj4t0jz5rZc0WAuajZedXsVFINV5QzDa3ctx3kDs9VXM2gpulkClTpoijVzp8yKq eVtQVHO7ceXRQmmCIhduZRpltu1Wb0rvOfp4EdG5yXvdwWX+olTxGqPLz4DMixDYTo2vDQxwb cKrqK6kQIvXAisSqX54lj13gaawWDHqACG0wPmug+JAt1b067CptmyhyUmO31EBKzCFbPrZ1r qJUBOHL1mo0xcEn22JtRueLfa+GpgYAN3iqgqQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc-8 warns that we copy TRAMPOLINE_32BIT_CODE_SIZE bytes from the pointer to the function into actual trampoline, when that pointer is only 8 bytes: In file included from arch/x86/boot/compressed/pgtable_64.c:3: arch/x86/boot/compressed/pgtable_64.c: In function 'paging_prepare': arch/x86/boot/compressed/../string.h:18:23: error: '__builtin_memcpy' reading 96 bytes from a region of size 8 [-Werror=stringop-overflow=] #define memcpy(d,s,l) __builtin_memcpy(d,s,l) ^~~~~~~~~~~~~~~~~~~~~~~ arch/x86/boot/compressed/pgtable_64.c:62:2: note: in expansion of macro 'memcpy' memcpy(trampoline + TRAMPOLINE_32BIT_CODE_OFFSET / sizeof(unsigned long), ^~~~~~ I assume what was intended here is to copy the trampoline itself rather than the pointer to the trampoline. Cc: Martin Sebor Fixes: b91993a87aff ("x86/boot/compressed/64: Prepare trampoline memory") Signed-off-by: Arnd Bergmann --- This is a fairly new warning in gcc, it's possible that the code is correct and the warning message got it wrong, please double-check this. Was the 32-bit trampoline code in the 64-bit decompressor tested successfully? --- arch/x86/boot/compressed/pgtable_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c index dad5da7b4c1a..35a0542fe397 100644 --- a/arch/x86/boot/compressed/pgtable_64.c +++ b/arch/x86/boot/compressed/pgtable_64.c @@ -60,7 +60,7 @@ struct paging_config paging_prepare(void) /* Copy trampoline code in place */ memcpy(trampoline + TRAMPOLINE_32BIT_CODE_OFFSET / sizeof(unsigned long), - &trampoline_32bit_src, TRAMPOLINE_32BIT_CODE_SIZE); + trampoline_32bit_src, TRAMPOLINE_32BIT_CODE_SIZE); /* * Set up a new page table that will be used for switching from 4-