public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Fabio Aiuto <fabioaiuto83@gmail.com>,
	Ross Schmidt <ross.schm.dev@gmail.com>,
	Marco Cesati <marcocesati@gmail.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Ivan Safonov <insafonov@gmail.com>,
	linux-staging@lists.linux.dev,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [v2] staging: rtl8723bs: avoid bogus gcc warning
Date: Tue, 27 Apr 2021 14:41:44 +0200	[thread overview]
Message-ID: <YIgGiMFvXlM4MYiK@kroah.com> (raw)
In-Reply-To: <CAK8P3a1N-JV-yJSVCXT__Aqdkj6LgdHqemPo2=7iZg+-EL32KA@mail.gmail.com>

On Tue, Apr 27, 2021 at 01:59:32PM +0200, Arnd Bergmann wrote:
> On Tue, Apr 27, 2021 at 11:33 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Apr 22, 2021 at 05:26:19PM +0200, Arnd Bergmann wrote:
> > > From: Arnd Bergmann <arnd@arndb.de>
> > >
> > > gcc gets confused by some of the type casts and produces an
> > > apparently senseless warning about an out-of-bound memcpy to
> > > an unrelated array in the same structure:
> > >
> > > drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c: In function 'rtw_cfg80211_ap_set_encryption':
> > > cc1: error: writing 8 bytes into a region of size 0 [-Werror=stringop-overflow=]
> > > In file included from drivers/staging/rtl8723bs/include/drv_types.h:32,
> > >                  from drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:10:
> > > drivers/staging/rtl8723bs/include/rtw_security.h:98:15: note: at offset [184, 4264] into destination object 'dot11AuthAlgrthm' of size 4
> > >    98 |         u32   dot11AuthAlgrthm;         /*  802.11 auth, could be open, shared, 8021x and authswitch */
> > >       |               ^~~~~~~~~~~~~~~~
> > > cc1: error: writing 8 bytes into a region of size 0 [-Werror=stringop-overflow=]
> > > drivers/staging/rtl8723bs/include/rtw_security.h:98:15: note: at offset [264, 4344] into destination object 'dot11AuthAlgrthm' of size 4
> > >
> > > This is a known gcc bug, and the patch here is only a workaround,
> > > but the approach of using a temporary variable to hold a pointer
> > > to the key also improves readability in addition to avoiding the
> > > warning, so overall this should still help.
> >
> > What version of gcc causes this?  Should this go into 5.13-final and be
> > backported?  Or is this only showing up on "unreleased" versions of gcc
> > and it is safe to wait until 5.14?
> 
> As I understand, this is related to
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99673
> 
> gcc-11.1.0 has now been released and it produces this warning.

What's the odds we can get gcc to fix their bug, as it's not a kernel
issue?  :)

thanks,

greg k-h

  reply	other threads:[~2021-04-27 12:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 15:26 [PATCH] [v2] staging: rtl8723bs: avoid bogus gcc warning Arnd Bergmann
2021-04-27  9:32 ` Greg Kroah-Hartman
2021-04-27 11:59   ` Arnd Bergmann
2021-04-27 12:41     ` Greg Kroah-Hartman [this message]
2021-04-27 13:00       ` Arnd Bergmann
2021-04-27 16:08         ` Greg Kroah-Hartman

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=YIgGiMFvXlM4MYiK@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=fabioaiuto83@gmail.com \
    --cc=insafonov@gmail.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=marcocesati@gmail.com \
    --cc=ross.schm.dev@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox