@samitouri / QOSamiQemu / commits / 2202e218e0

vfio/pci: Replace abort() with g_assert_not_reached()

This check was originally introduced in commit b3ebc10c373e ("vfio-pci: Add debug config options to disable MSI/X KVM support") as part of a debug block to retrieve the MSI/MSIX message, and was later moved by commit 0de70dc7bab1 ("vfio/pci: Rename MSI/X functions for easier tracing") into the main interrupt handling path, becoming production code. Under normal conditions, this code path cannot be reached because the BQL serializes all handler registration, vdev->interrupt updates, and handler removal. Replace abort() with g_assert_not_reached(), which is preferred nowdays, and add a comment clarifying the purpose. Cc: Alex Williamson <alex@shazbot.org> Acked-by: Alex Williamson <alex@shazbot.org> Link: https://lore.kernel.org/qemu-devel/20260506152353.1657838-1-clg@redhat.com Signed-off-by: Cédric Le Goater <clg@redhat.com>

Cédric Le Goater committed May 6, 2026 at 17:23 UTC 2202e218e0a92e9ba5be8099b81c6a2efd61df9c
1 file changed +6 -1
hw/vfio/pci.c
+6 -1
@@ -451,7 +451,12 @@ static void vfio_msi_interrupt(void *opaque)
451 get_msg = msi_get_message;
452 notify = msi_notify;
453 } else {
454 - abort();
454 + /*
455 + * Interrupt state transitions (MSI/MSI-X -> NONE/INTx) are
456 + * protected by the BQL, and eventfd handlers are strictly
457 + * unregistered before vdev->interrupt is modified.
458 + */
459 + g_assert_not_reached();
460 }
461
462 msg = get_msg(pdev, nr);