lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250410075928.GN199604@unreal>
Date: Thu, 10 Apr 2025 10:59:28 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Jason Gunthorpe <jgg@...pe.ca>, Arnd Bergmann <arnd@...nel.org>,
	Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Thomas Hellström <thomas.hellstrom@...ux.intel.com>,
	Jani Nikula <jani.nikula@...el.com>,
	Christian König <christian.koenig@....com>,
	linux <linux@...blig.org>, Maher Sanalla <msanalla@...dia.com>,
	linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] RDMA/hfi1: use a struct group to avoid warning

On Tue, Apr 08, 2025 at 02:40:38PM +0200, Arnd Bergmann wrote:
> On Mon, Apr 7, 2025, at 20:27, Jason Gunthorpe wrote:
> > On Thu, Apr 03, 2025 at 04:47:53PM +0200, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@...db.de>
> >> 
> >> On gcc-11 and earlier, the driver sometimes produces a warning
> >> for memset:
> >> 
> >> In file included from include/linux/string.h:392,
> >>                  from drivers/infiniband/hw/hfi1/mad.c:6:
> >> In function 'fortify_memset_chk',
> >>     inlined from '__subn_get_opa_hfi1_cong_log' at drivers/infiniband/hw/hfi1/mad.c:3873:2,
> >>     inlined from 'subn_get_opa_sma' at drivers/infiniband/hw/hfi1/mad.c:4114:9:
> >> include/linux/fortify-string.h:480:4: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror]
> >>     __write_overflow_field(p_size_field, size);
> >>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> 
> >> This seems to be a false positive, and I found no nice way to rewrite
> >> the code to avoid the warning, but adding a a struct group works.
> >
> > Er.. so do we really want to fix it or just ignore this on gcc-11? Or
> > is there really a compile bug here and it is mis-generating the code?
> >
> > The unneeded struct group seems ugly to me?
> 
> Having a clean build would be nice though. Do you think a patch
> that just turns off the warning locally would be better?

I don't think so, as you will need to disable warning for specific
compiler, which won't be nice.

My preference is to have a fix.

Thanks

> 
>       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ