The size of the string should not exceed 27 or 28 bytes less than RTE_MEMZONE_NAMESIZE.
On Wed, Apr 22, 2026 at 12:44 AM Денис Люлин <[email protected]> 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. > > 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 > [email protected]: > > On Fri, 17 Apr 2026 12:43:07 -0400 > Kishore Padmanabha <[email protected] > <https://e.mail.ru/[email protected]>> 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. > >
smime.p7s
Description: S/MIME Cryptographic Signature

