DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Денис Люлин" <lyulin.2003@mail.ru>
To: "Stephen Hemminger" <stephen@networkplumber.org>
Cc: "Ajit Khaparde" <ajit.khaparde@broadcom.com>,
	"Sriharsha Basavapatna" <sriharsha.basavapatna@broadcom.com>,
	dev@dpdk.org, stable@dpdk.org,
	"Kishore Padmanabha" <kishore.padmanabha@broadcom.com>
Subject: Re[2]: [PATCH 1/1] net/bnxt: fix string bounds checks and format specifiers
Date: Wed, 22 Apr 2026 07:44:34 +0300	[thread overview]
Message-ID: <1776833074.769361490@f461.i.mail.ru> (raw)
In-Reply-To: <20260417100357.7ef0dd36@phoenix.local>

[-- Attachment #1: Type: text/plain, Size: 2028 bytes --]

> > diff --git a/drivers/net/bnxt/bnxt_ethdev.c
> > b/drivers/net/bnxt/bnxt_ethdev.c
> > index b677f9491d..bb02a2579b 100644
> > --- a/drivers/net/bnxt/bnxt_ethdev.c
> > +++ b/drivers/net/bnxt/bnxt_ethdev.c
> > @@ -652,8 +652,9 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp)
> >
> > max_fc = bp->flow_stat->max_fc;
> >
> > - sprintf(type, "bnxt_rx_fc_in_" PCI_PRI_FMT, pdev->addr.domain,
> > - pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
> > + snprintf(type, RTE_MEMZONE_NAMESIZE, "bnxt_rx_fc_in_" PCI_PRI_FMT,
> > + pdev->addr.domain, pdev->addr.bus,
> > + pdev->addr.devid, pdev->addr.function);
> > /* 4 bytes for each counter-id */

>Rather than silently truncating, it should return an error.

As far as I understand, these strings are used as diagnostic information when tracing is enabled. Is the truncation of a debug string so critical that we should interrupt device initialization by returning an error? For example, Linux kernel truncates worker thread names if the strings are too long

пятница, 17 апреля 2026г., 20:04 +03:00 от Stephen Hemminger stephen@networkplumber.org :

> 
> On Fri, 17 Apr 2026 12:43:07 -0400
> Kishore Padmanabha <kishore.padmanabha@broadcom.com (
> /compose?To=kishore.padmanabha@broadcom.com )> wrote:
> 
> > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c
> > > b/drivers/net/bnxt/bnxt_ethdev.c
> > > index b677f9491d..bb02a2579b 100644
> > > --- a/drivers/net/bnxt/bnxt_ethdev.c
> > > +++ b/drivers/net/bnxt/bnxt_ethdev.c
> > > @@ -652,8 +652,9 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp)
> > >
> > > max_fc = bp->flow_stat->max_fc;
> > >
> > > - sprintf(type, "bnxt_rx_fc_in_" PCI_PRI_FMT, pdev->addr.domain,
> > > - pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
> > > + snprintf(type, RTE_MEMZONE_NAMESIZE, "bnxt_rx_fc_in_" PCI_PRI_FMT,
> > > + pdev->addr.domain, pdev->addr.bus,
> > > + pdev->addr.devid, pdev->addr.function);
> > > /* 4 bytes for each counter-id */
> 
> Rather than silently truncating, it should return an error.
>

[-- Attachment #2: Type: text/html, Size: 2897 bytes --]

  reply	other threads:[~2026-04-24  7:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17  4:56 [PATCH 1/1] net/bnxt: fix string bounds checks and format specifiers Denis Lyulin
2026-04-17 16:43 ` Kishore Padmanabha
2026-04-17 17:03   ` Stephen Hemminger
2026-04-22  4:44     ` Денис Люлин [this message]
2026-04-22 13:35       ` Re[2]: " Kishore Padmanabha

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=1776833074.769361490@f461.i.mail.ru \
    --to=lyulin.2003@mail.ru \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=sriharsha.basavapatna@broadcom.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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