From patchwork Tue Jan 7 21:40:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11321907 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45CA0930 for ; Tue, 7 Jan 2020 21:40:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1CC9D206DB for ; Tue, 7 Jan 2020 21:40:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CC9D206DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4536A8E0005; Tue, 7 Jan 2020 16:40:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4039E8E0001; Tue, 7 Jan 2020 16:40:48 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 319D68E0005; Tue, 7 Jan 2020 16:40:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 1D3068E0001 for ; Tue, 7 Jan 2020 16:40:48 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 8A566181AEF07 for ; Tue, 7 Jan 2020 21:40:47 +0000 (UTC) X-FDA: 76352158134.03.word97_23eef7990cb22 X-Spam-Summary: 2,0,0,a495666b7cde1805,d41d8cd98f00b204,arnd@arndb.de,:akpm@linux-foundation.org:oleksandr@redhat.com::arnd@arndb.de:acme@redhat.com:will@kernel.org:mhiramat@kernel.org:songliubraving@fb.com:adobriyan@gmail.com:maz@kernel.org:tglx@linutronix.de:linux-kernel@vger.kernel.org,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1431:1437:1515:1534:1541:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3870:3871:3872:5007:6119:6261:6742:7875:7903:9108:9707:10004:11026:11658:11914:12160:12297:12438:12555:12679:12895:13069:13161:13229:13311:13357:13894:14096:14181:14384:14394:14721:21080:21451:21627:21740:21990:30003:30029:30054:30070,0,RBL:212.227.126.131:@arndb.de:.lbl8.mailshell.net-62.8.6.100 66.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: word97_23eef7990cb22 X-Filterd-Recvd-Size: 3912 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jan 2020 21:40:46 +0000 (UTC) Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mv2tE-1jfX9141SK-00r2Gc; Tue, 07 Jan 2020 22:40:44 +0100 From: Arnd Bergmann To: Andrew Morton Cc: Oleksandr Natalenko , linux-mm@kvack.org, Arnd Bergmann , Arnaldo Carvalho de Melo , Will Deacon , Masami Hiramatsu , Song Liu , Alexey Dobriyan , Marc Zyngier , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH] kallsyms: work around bogus -Wrestrict warning Date: Tue, 7 Jan 2020 22:40:26 +0100 Message-Id: <20200107214042.855757-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MI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6oczdvj2aE3RiULOwL1ApnZFK8UVEIL60V9wq iFbMRmAJKvSW29xBAP9yhOdhCmstJ9czchd6cPQTxo34PWzgkBVjnuRJR98R9q8veg/JuBg7t bLWRbtqIQDCDK7WOsqUA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: gcc -O3 produces some really odd warnings for this file: kernel/kallsyms.c: In function 'sprint_symbol': kernel/kallsyms.c:369:3: error: 'strcpy' source argument is the same as destination [-Werror=restrict] strcpy(buffer, name); ^~~~~~~~~~~~~~~~~~~~ kernel/kallsyms.c: In function 'sprint_symbol_no_offset': kernel/kallsyms.c:369:3: error: 'strcpy' source argument is the same as destination [-Werror=restrict] strcpy(buffer, name); ^~~~~~~~~~~~~~~~~~~~ kernel/kallsyms.c: In function 'sprint_backtrace': kernel/kallsyms.c:369:3: error: 'strcpy' source argument is the same as destination [-Werror=restrict] strcpy(buffer, name); ^~~~~~~~~~~~~~~~~~~~ This obviously cannot be since it is preceded by an 'if (name != buffer)' check. Using sprintf() instead of strcpy() is a bit wasteful but is the best workaround I could come up with. Fixes: mmtom ("init/Kconfig: enable -O3 for all arches") Signed-off-by: Arnd Bergmann --- kernel/kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index d812b90f4c86..726b8eeb223e 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -366,7 +366,7 @@ static int __sprint_symbol(char *buffer, unsigned long address, return sprintf(buffer, "0x%lx", address - symbol_offset); if (name != buffer) - strcpy(buffer, name); + sprintf(buffer, "%s", name); len = strlen(buffer); offset -= symbol_offset;