From: Dan Carpenter <dan.carpenter@oracle.com>
To: jasowang@redhat.com
Cc: virtualization@lists.linux-foundation.org
Subject: [bug report] vdpa: set the virtqueue num during register
Date: Thu, 25 Feb 2021 18:10:36 +0300 [thread overview]
Message-ID: <YDe97MG41eViGPxr@mwanda> (raw)
Hello Jason Wang,
The patch ddd50f4495d3: "vdpa: set the virtqueue num during register"
from Feb 23, 2021, leads to the following static checker warning:
drivers/vdpa/ifcvf/ifcvf_main.c:433 ifcvf_probe()
warn: risky error pointer math: '__vdpa_alloc_device(dev, &ifc_vdpa_ops, 2592 + (0), (0)))'
include/linux/vdpa.h
255 #define vdpa_alloc_device(dev_struct, member, parent, config, name) \
256 container_of(__vdpa_alloc_device( \
257 parent, config, \
258 sizeof(dev_struct) + \
259 BUILD_BUG_ON_ZERO(offsetof( \
260 dev_struct, member)), name), \
261 dev_struct, member)
262
The __vdpa_alloc_device() returns an error pointer and if we call
container_of() on then that's a bug... (Unless the container_of() is
known to be a no-op, in which case it's sort of ugly but fine, I guess.
There is one caller where this is the case.).
drivers/vdpa/ifcvf/ifcvf_main.c
432
433 adapter = vdpa_alloc_device(struct ifcvf_adapter, vdpa,
434 dev, &ifc_vdpa_ops, NULL);
435 if (adapter == NULL) {
All the other caller check for NULL. :P
436 IFCVF_ERR(pdev, "Failed to allocate vDPA structure");
437 return -ENOMEM;
438 }
439
440 pci_set_master(pdev);
441 pci_set_drvdata(pdev, adapter);
442
regards,
dan carpenter
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
reply other threads:[~2021-02-25 15:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=YDe97MG41eViGPxr@mwanda \
--to=dan.carpenter@oracle.com \
--cc=jasowang@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