[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8ebab59-1cec-42d-6fb9-44aa1a464ae2@namei.org>
Date: Thu, 25 Mar 2021 07:50:33 +1100 (AEDT)
From: James Morris <jmorris@...ei.org>
To: Arnd Bergmann <arnd@...nel.org>
cc: linux-kernel@...r.kernel.org, Martin Sebor <msebor@....gnu.org>,
Serge Hallyn <serge@...lyn.com>, Arnd Bergmann <arnd@...db.de>,
x86@...nel.org, Ning Sun <ning.sun@...el.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Kalle Valo <kvalo@...eaurora.org>,
Simon Kelley <simon@...kelleys.org.uk>,
James Smart <james.smart@...adcom.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
Anders Larsen <al@...rsen.net>, Tejun Heo <tj@...nel.org>,
Imre Deak <imre.deak@...el.com>,
linux-arm-kernel@...ts.infradead.org,
tboot-devel@...ts.sourceforge.net, intel-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, ath11k@...ts.infradead.org,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-scsi@...r.kernel.org, cgroups@...r.kernel.org,
linux-security-module@...r.kernel.org,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Christian Brauner <christian.brauner@...ntu.com>,
Kees Cook <keescook@...omium.org>,
Miklos Szeredi <mszeredi@...hat.com>,
Tycho Andersen <tycho@...ho.pizza>
Subject: Re: [PATCH 03/11] security: commoncap: fix -Wstringop-overread
warning
On Mon, 22 Mar 2021, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> gcc-11 introdces a harmless warning for cap_inode_getsecurity:
>
> security/commoncap.c: In function ‘cap_inode_getsecurity’:
> security/commoncap.c:440:33: error: ‘memcpy’ reading 16 bytes from a region of size 0 [-Werror=stringop-overread]
> 440 | memcpy(&nscap->data, &cap->data, sizeof(__le32) * 2 * VFS_CAP_U32);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> The problem here is that tmpbuf is initialized to NULL, so gcc assumes
> it is not accessible unless it gets set by vfs_getxattr_alloc(). This is
> a legitimate warning as far as I can tell, but the code is correct since
> it correctly handles the error when that function fails.
>
> Add a separate NULL check to tell gcc about it as well.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git fixes-v5.12
--
James Morris
<jmorris@...ei.org>
Powered by blists - more mailing lists