* [bug report] vdpa: set the virtqueue num during register
@ 2021-02-25 15:10 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-02-25 15:10 UTC (permalink / raw)
To: jasowang; +Cc: virtualization
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-02-25 15:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-25 15:10 [bug report] vdpa: set the virtqueue num during register Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.