From: Simon Horman <horms@kernel•org>
To: Andrew Lunn <andrew@lunn•ch>
Cc: "David S. Miller" <davem@davemloft•net>,
Eric Dumazet <edumazet@google•com>,
Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>,
Sunil Goutham <sgoutham@marvell•com>,
Geethasowjanya Akula <gakula@marvell•com>,
Subbaraya Sundeep <sbhatta@marvell•com>,
Hariprasad Kelam <hkelam@marvell•com>,
Dan Carpenter <dan.carpenter@linaro•org>,
netdev@vger•kernel.org
Subject: Re: [PATCH net-next] octeontx2-pf: Treat truncation of IRQ name as an error
Date: Wed, 1 May 2024 21:11:46 +0100 [thread overview]
Message-ID: <20240501201146.GM516117@kernel.org> (raw)
In-Reply-To: <e2578f7a-7020-4ae4-94d7-69e828a523d5@lunn.ch>
On Wed, May 01, 2024 at 09:46:15PM +0200, Andrew Lunn wrote:
> On Wed, May 01, 2024 at 07:27:09PM +0100, Simon Horman wrote:
> > According to GCC, the constriction of irq_name in otx2_open()
> > may, theoretically, be truncated.
> >
> > This patch takes the approach of treating such a situation as an error
> > which it detects by making use of the return value of snprintf, which is
> > the total number of bytes, including the trailing '\0', that would have
> > been written.
> > + name_len = snprintf(irq_name, NAME_SIZE, "%s-rxtx-%d",
> > + pf->netdev->name, qidx);
> > + if (name_len >= NAME_SIZE) {
>
> You say name_len includes the trailing \0. So you should be able to
> get NAME_SIZE bytes into an NAME_SIZE length array? So i think this
> can be >, not >= ?
Sorry, I misspoke.
name_len excludes the trailing \0.
--
pw-bot: changes-requested
next prev parent reply other threads:[~2024-05-01 20:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 18:27 [PATCH net-next] octeontx2-pf: Treat truncation of IRQ name as an error Simon Horman
2024-05-01 19:46 ` Andrew Lunn
2024-05-01 20:11 ` Simon Horman [this message]
2024-05-01 20:21 ` Andrew Lunn
2024-05-01 20:33 ` Simon Horman
2024-05-03 6:20 ` [EXTERNAL] " Geethasowjanya Akula
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=20240501201146.GM516117@kernel.org \
--to=horms@kernel$(echo .)org \
--cc=andrew@lunn$(echo .)ch \
--cc=dan.carpenter@linaro$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=gakula@marvell$(echo .)com \
--cc=hkelam@marvell$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=sbhatta@marvell$(echo .)com \
--cc=sgoutham@marvell$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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