Message ID | 20240702020033.139261-3-lulu@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | virtio-pci: Fix the use of an uninitialized irqfd | expand |
On Tue, Jul 2, 2024 at 10:00 AM Cindy Lu <lulu@redhat.com> wrote: > > Add the return value check for kvm_virtio_pci_vector_use_one(). > Since the return value of function virtio_pci_set_vector() is void, > we can do nothing here. So just add the error message here. > > Signed-off-by: Cindy Lu <lulu@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Thanks
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 6b62165ef6..dc31a37ec0 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1455,7 +1455,9 @@ static void virtio_pci_set_vector(VirtIODevice *vdev, } /* If the new vector changed need to set it up. */ if (kvm_irqfd && new_vector != VIRTIO_NO_VECTOR) { - kvm_virtio_pci_vector_use_one(proxy, queue_no); + if (kvm_virtio_pci_vector_use_one(proxy, queue_no)) { + virtio_error(vdev, "fail to set the vector %d", new_vector); + } } }
Add the return value check for kvm_virtio_pci_vector_use_one(). Since the return value of function virtio_pci_set_vector() is void, we can do nothing here. So just add the error message here. Signed-off-by: Cindy Lu <lulu@redhat.com> --- hw/virtio/virtio-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)