netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Kees Cook <kees@kernel.org>
Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] emulex/benet: Annotate flash_cookie as nonstring
Date: Mon, 21 Apr 2025 15:51:10 +0100	[thread overview]
Message-ID: <20250421145110.GO2789685@horms.kernel.org> (raw)
In-Reply-To: <20250416221028.work.967-kees@kernel.org>

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@kernel.org>

I am assuming this is for net-next.

Reviewed-by: Simon Horman <horms@kernel.org>


  reply	other threads:[~2025-04-21 14:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-16 22:10 [PATCH] emulex/benet: Annotate flash_cookie as nonstring Kees Cook
2025-04-21 14:51 ` Simon Horman [this message]
2025-04-23  1:30 ` patchwork-bot+netdevbpf

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=20250421145110.GO2789685@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=sriharsha.basavapatna@broadcom.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).