[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250421145110.GO2789685@horms.kernel.org>
Date: Mon, 21 Apr 2025 15:51:10 +0100
From: Simon Horman <horms@...nel.org>
To: Kees Cook <kees@...nel.org>
Cc: Ajit Khaparde <ajit.khaparde@...adcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@...adcom.com>,
Somnath Kotur <somnath.kotur@...adcom.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] emulex/benet: Annotate flash_cookie as nonstring
On Wed, Apr 16, 2025 at 03:10:29PM -0700, Kees Cook wrote:
> GCC 15's new -Wunterminated-string-initialization notices that the 32
> character "flash_cookie" (which is not used as a C-String)
> needs to be marked as "nonstring":
>
> drivers/net/ethernet/emulex/benet/be_cmds.c:2618:51: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (17 chars into 16 available) [-Wunterminated-string-initialization]
> 2618 | static char flash_cookie[2][16] = {"*** SE FLAS", "H DIRECTORY *** "};
> | ^~~~~~~~~~~~~~~~~~
>
> Add this annotation, avoid using a multidimensional array, but keep the
> string split (with a comment about why). Additionally mark it const
> and annotate the "cookie" member that is being memcmp()ed against as
> nonstring too.
>
> Signed-off-by: Kees Cook <kees@...nel.org>
I am assuming this is for net-next.
Reviewed-by: Simon Horman <horms@...nel.org>
Powered by blists - more mailing lists