diff options
author | Kunwu Chan <chentao@kylinos.cn> | 2024-01-15 14:34:34 +0800 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2024-02-22 12:14:37 -0700 |
commit | 19032628bd7ce8a39cdf0521b6418bf88c25ec80 (patch) | |
tree | 5f09cbb25bb4335e54f7698ddd6195dfbe241850 /drivers/vfio | |
parent | b401b621758e46812da61fa58a67c3fd8d91de0d (diff) |
vfio/pci: WARN_ON driver_override kasprintf failure
kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.
This is a blocking notifier callback, so errno isn't a proper return
value. Use WARN_ON to small allocation failures.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Link: https://lore.kernel.org/r/20240115063434.20278-1-chentao@kylinos.cn
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r-- | drivers/vfio/pci/vfio_pci_core.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index 1cbc990d42e0..61aa19666050 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -2047,6 +2047,7 @@ static int vfio_pci_bus_notifier(struct notifier_block *nb, pci_name(pdev)); pdev->driver_override = kasprintf(GFP_KERNEL, "%s", vdev->vdev.ops->name); + WARN_ON(!pdev->driver_override); } else if (action == BUS_NOTIFY_BOUND_DRIVER && pdev->is_virtfn && physfn == vdev->pdev) { struct pci_driver *drv = pci_dev_driver(pdev); |