From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Arnd Bergmann <arnd@arndb.de>,
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@vger.kernel.org
Subject: Re: [PATCH] [v2] staging: rtl8723bs: avoid bogus gcc warning
Date: Tue, 27 Apr 2021 11:32:29 +0200 [thread overview]
Message-ID: <YIfaLbsAUjs86418@kroah.com> (raw)
In-Reply-To: <20210422152648.2891996-1-arnd@kernel.org>
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?
thanks,
greg k-h
next prev parent reply other threads:[~2021-04-27 9:32 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 [this message]
2021-04-27 11:59 ` Arnd Bergmann
2021-04-27 12:41 ` Greg Kroah-Hartman
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=YIfaLbsAUjs86418@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arnd@arndb.de \
--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;
as well as URLs for NNTP newsgroup(s).