From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754144AbdHWOND (ORCPT ); Wed, 23 Aug 2017 10:13:03 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57128 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754001AbdHWONC (ORCPT ); Wed, 23 Aug 2017 10:13:02 -0400 Date: Wed, 23 Aug 2017 15:11:48 +0100 From: Mark Rutland To: Ard Biesheuvel Cc: Arnd Bergmann , "linux-kernel@vger.kernel.org" , Nathan Lynch , Russell King , "linux-arm-kernel@lists.infradead.org" , Nicolas Pitre Subject: Re: [PATCH] [RFC] ARM: vdso: work around gcc-8 warning Message-ID: <20170823141148.GB10088@leverpostej> References: <20170823140538.1590432-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 23, 2017 at 03:07:04PM +0100, Ard Biesheuvel wrote: > On 23 August 2017 at 15:05, Arnd Bergmann wrote: > > gcc-8 correctly points out that reading four bytes from a pointer to a > > 'char' variable is wrong > > > > arch/arm/kernel/vdso.c: In function 'vdso_init': > > arch/arm/kernel/vdso.c:200:6: error: '__builtin_memcmp_eq' reading 4 bytes from a region of size 1 [-Werror=stringop-overflow=] > > > > However, in this case the variable just stands for the beginning of the > > vdso and is not actually a 'char', so the code is doing what it is meant > > to do. > > > > Not sure what the best solution for this is, changing the hack to > > declare the variable as 'int' instead makes the warning go away. > > > > Signed-off-by: Arnd Bergmann > > --- > > arch/arm/include/asm/vdso.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/arm/include/asm/vdso.h b/arch/arm/include/asm/vdso.h > > index d0295f1dd1a3..eff7d3a1d1ce 100644 > > --- a/arch/arm/include/asm/vdso.h > > +++ b/arch/arm/include/asm/vdso.h > > @@ -11,7 +11,7 @@ struct mm_struct; > > > > void arm_install_vdso(struct mm_struct *mm, unsigned long addr); > > > > -extern char vdso_start, vdso_end; > > +extern int vdso_start, vdso_end; > > > > extern unsigned int vdso_total_pages; > > May I suggest > > extern char vdso_start[], vdso_end[]; FWIW, arm64 does this to solve this problem, since commit: dbbb08f500d61463 ("arm64, vdso: Define vdso_{start,end} as array") ... and x86 has done likewise for a while. Thanks, Mark.