From f25f8f36764481a99c8deac357da40b034d9f00e Mon Sep 17 00:00:00 2001 From: Jonas Pfefferle Date: Thu, 26 Oct 2017 17:19:49 +0200 Subject: [PATCH] bus/pci: check VFIO reset ioctl error Check return value of device reset ioctl Coverity issue: 195003 Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping") Signed-off-by: Jonas Pfefferle Acked-by: Anatoly Burakov --- drivers/bus/pci/linux/pci_vfio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 1a3c308e7c..360eed3800 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -339,7 +339,11 @@ pci_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) } /* Reset the device */ - ioctl(vfio_dev_fd, VFIO_DEVICE_RESET); + if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET)) { + RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n", + errno, strerror(errno)); + return -1; + } return 0; } -- 2.20.1