From: Nathan Chancellor <nathan@kernel.org>
To: Alvaro Karsz <alvaro.karsz@solid-run.com>
Cc: virtualization@lists.linux-foundation.org,
linux-pci@vger.kernel.org, bhelgaas@google.com,
"Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
llvm@lists.linux.dev
Subject: Re: [PATCH 3/3 v6] virtio: vdpa: new SolidNET DPU driver.
Date: Tue, 20 Dec 2022 09:32:38 -0700 [thread overview]
Message-ID: <Y6HjpvDfIusAz2uS@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20221219083511.73205-4-alvaro.karsz@solid-run.com>
Hi Alvaro,
On Mon, Dec 19, 2022 at 10:35:11AM +0200, Alvaro Karsz wrote:
> This commit includes:
> 1) The driver to manage the controlplane over vDPA bus.
> 2) A HW monitor device to read health values from the DPU.
>
> Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
<snip>
> +static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
> +{
> + char name[25];
> + int ret, i, mask = 0;
> + /* We don't know which BAR will be used to communicate..
> + * We will map every bar with len > 0.
> + *
> + * Later, we will discover the BAR and unmap all other BARs.
> + */
> + for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> + if (pci_resource_len(pdev, i))
> + mask |= (1 << i);
> + }
> +
> + /* No BAR can be used.. */
> + if (!mask) {
> + SNET_ERR(pdev, "Failed to find a PCI BAR\n");
> + return -ENODEV;
> + }
> +
> + snprintf(name, SNET_NAME_SIZE, "psnet[%s]-bars", pci_name(pdev));
> + ret = pcim_iomap_regions(pdev, mask, name);
> + if (ret) {
> + SNET_ERR(pdev, "Failed to request and map PCI BARs\n");
> + return ret;
> + }
> +
> + for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> + if (mask & (1 << i))
> + psnet->bars[i] = pcim_iomap_table(pdev)[i];
> + }
> +
> + return 0;
> +}
> +
> +static int snet_open_vf_bar(struct pci_dev *pdev, struct snet *snet)
> +{
> + char name[20];
> + int ret;
> +
> + snprintf(name, SNET_NAME_SIZE, "snet[%s]-bar", pci_name(pdev));
> + /* Request and map BAR */
> + ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name);
> + if (ret) {
> + SNET_ERR(pdev, "Failed to request and map PCI BAR for a VF\n");
> + return ret;
> + }
> +
> + snet->bar = pcim_iomap_table(pdev)[snet->psnet->cfg.vf_bar];
> +
> + return 0;
> +}
This patch as commit 73a720b16fa1 ("virtio: vdpa: new SolidNET DPU
driver.") in next-20221220 causes the following clang warnings:
drivers/vdpa/solidrun/snet_main.c:561:2: error: 'snprintf' size argument is too large; destination buffer has size 25, but size argument is 256 [-Werror,-Wfortify-source]
snprintf(name, SNET_NAME_SIZE, "psnet[%s]-bars", pci_name(pdev));
^
drivers/vdpa/solidrun/snet_main.c:581:2: error: 'snprintf' size argument is too large; destination buffer has size 20, but size argument is 256 [-Werror,-Wfortify-source]
snprintf(name, SNET_NAME_SIZE, "snet[%s]-bar", pci_name(pdev));
^
2 errors generated.
This does not appear to be a false positive but what was the intent
here? Should the local name variables increase their length or should
the buffer length be reduced?
Cheers,
Nathan
next parent reply other threads:[~2022-12-20 16:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221219083511.73205-1-alvaro.karsz@solid-run.com>
[not found] ` <20221219083511.73205-4-alvaro.karsz@solid-run.com>
2022-12-20 16:32 ` Nathan Chancellor [this message]
2022-12-20 16:46 ` [PATCH 3/3 v6] virtio: vdpa: new SolidNET DPU driver Alvaro Karsz
2022-12-20 20:49 ` Nathan Chancellor
2022-12-20 23:20 ` Michael S. Tsirkin
2022-12-20 21:48 ` Arnd Bergmann
2022-12-21 6:40 ` Michael S. Tsirkin
2022-12-21 7:05 ` Alvaro Karsz
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=Y6HjpvDfIusAz2uS@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=alvaro.karsz@solid-run.com \
--cc=bhelgaas@google.com \
--cc=jasowang@redhat.com \
--cc=jdelvare@suse.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=llvm@lists.linux.dev \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.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