From patchwork Thu Oct 26 15:13:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Pfefferle1 X-Patchwork-Id: 30985 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 59DB31BAB4; Thu, 26 Oct 2017 17:13:17 +0200 (CEST) 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 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Oct 2017 16:13:07 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9QFD6jI27132096; Thu, 26 Oct 2017 15:13:06 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4EC93AE059; Thu, 26 Oct 2017 16:07:00 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1CCC9AE055; Thu, 26 Oct 2017 16:07:00 +0100 (BST) Received: from malvito.zurich.ibm.com (unknown [9.4.69.122]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 26 Oct 2017 16:07:00 +0100 (BST) From: Jonas Pfefferle To: dev@dpdk.org Cc: anatoly.burakov@intel.com, Jonas Pfefferle Date: Thu, 26 Oct 2017 17:13:04 +0200 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 17102615-0020-0000-0000-000003C53C30 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102615-0021-0000-0000-0000425A1FFC Message-Id: <1509030784-20704-1-git-send-email-jpf@zurich.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-26_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260201 Subject: [dpdk-dev] [PATCH] vfio: check ioctl return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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; }