Skip to content

Commit 1903262

Browse files
KunWuChanawilliam
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
1 parent b401b62 commit 1903262

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/vfio/pci/vfio_pci_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,7 @@ static int vfio_pci_bus_notifier(struct notifier_block *nb,
20472047
pci_name(pdev));
20482048
pdev->driver_override = kasprintf(GFP_KERNEL, "%s",
20492049
vdev->vdev.ops->name);
2050+
WARN_ON(!pdev->driver_override);
20502051
} else if (action == BUS_NOTIFY_BOUND_DRIVER &&
20512052
pdev->is_virtfn && physfn == vdev->pdev) {
20522053
struct pci_driver *drv = pci_dev_driver(pdev);

0 commit comments

Comments
 (0)