From: Leon Romanovsky <leon@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Jason Gunthorpe" <jgg@ziepe.ca>,
"Arnd Bergmann" <arnd@kernel.org>,
"Dennis Dalessandro" <dennis.dalessandro@cornelisnetworks.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Jani Nikula" <jani.nikula@intel.com>,
"Christian König" <christian.koenig@amd.com>,
linux <linux@treblig.org>, "Maher Sanalla" <msanalla@nvidia.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/hfi1: use a struct group to avoid warning
Date: Thu, 10 Apr 2025 10:59:28 +0300 [thread overview]
Message-ID: <20250410075928.GN199604@unreal> (raw)
In-Reply-To: <e477f8c0-5478-43b5-9d59-297efc32d20e@app.fastmail.com>
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@arndb.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
prev parent reply other threads:[~2025-04-10 7:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 14:47 [PATCH] RDMA/hfi1: use a struct group to avoid warning Arnd Bergmann
2025-04-07 18:27 ` Jason Gunthorpe
2025-04-08 12:40 ` Arnd Bergmann
2025-04-10 7:59 ` Leon Romanovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250410075928.GN199604@unreal \
--to=leon@kernel.org \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=christian.koenig@amd.com \
--cc=dennis.dalessandro@cornelisnetworks.com \
--cc=jani.nikula@intel.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux@treblig.org \
--cc=msanalla@nvidia.com \
--cc=rostedt@goodmis.org \
--cc=thomas.hellstrom@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.