From: Stephen Hemminger <stephen@networkplumber.org>
To: Gregory Etelson <getelson@nvidia.com>
Cc: <dev@dpdk.org>, <mkashani@nvidia.com>, <rasland@nvidia.com>,
Dariusz Sosnowski <dsosnowski@nvidia.com>,
Aman Singh <aman.deep.singh@intel.com>,
Shani Peretz <shperetz@nvidia.com>
Subject: Re: [PATCH] app/testpmd: fix devargs format in port attach
Date: Thu, 30 Oct 2025 08:53:04 -0700 [thread overview]
Message-ID: <20251030085304.41795417@phoenix> (raw)
In-Reply-To: <20251030092016.226974-1-getelson@nvidia.com>
On Thu, 30 Oct 2025 11:20:15 +0200
Gregory Etelson <getelson@nvidia.com> wrote:
> static char *
> -convert_pci_address_format(const char *identifier, char *pci_buffer, size_t buf_size)
> +convert_pci_address_format(const char *identifier, char *pci_buffer)
> {
> struct rte_devargs da;
> struct rte_pci_addr pci_addr;
> @@ -3430,7 +3430,8 @@ convert_pci_address_format(const char *identifier, char *pci_buffer, size_t buf_
> if (rte_pci_addr_parse(da.name, &pci_addr) != 0)
> return NULL;
>
> - rte_pci_device_name(&pci_addr, pci_buffer, buf_size);
> + rte_pci_device_name(&pci_addr, pci_buffer, PCI_PRI_STR_SIZE);
> + sprintf(pci_buffer + strlen(pci_buffer), ",%s", da.args);
> return pci_buffer;
> }
It would be safer to keep the buf_size argument. It avoids any overflow issues.
Many tools flag any direct sprintf usage as an error.
next prev parent reply other threads:[~2025-10-30 15:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 9:20 Gregory Etelson
2025-10-30 15:53 ` Stephen Hemminger [this message]
2025-10-30 17:17 ` [PATCH v2] " Gregory Etelson
2025-10-30 17:47 ` Stephen Hemminger
2025-10-31 6:18 ` [PATCH v3] " Gregory Etelson
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=20251030085304.41795417@phoenix \
--to=stephen@networkplumber.org \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=getelson@nvidia.com \
--cc=mkashani@nvidia.com \
--cc=rasland@nvidia.com \
--cc=shperetz@nvidia.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).