From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonas Pfefferle Subject: [PATCH] vfio: check ioctl return value Date: Thu, 26 Oct 2017 17:13:04 +0200 Message-ID: <1509030784-20704-1-git-send-email-jpf@zurich.ibm.com> Cc: anatoly.burakov@intel.com, Jonas Pfefferle To: dev@dpdk.org Return-path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by dpdk.org (Postfix) with ESMTP id 1F1D01BA94 for ; Thu, 26 Oct 2017 17:13:14 +0200 (CEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9QF7BDT128093 for ; Thu, 26 Oct 2017 11:13:12 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dufhm1dp7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 26 Oct 2017 11:13:12 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Oct 2017 16:13:09 +0100 List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Check return value of device reset ioctl Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping") Coverity issue: 195003 Signed-off-by: Jonas Pfefferle --- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index d407c87..d5f6637 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -333,7 +333,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.7.4