From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C27FEA04BC for ; Thu, 17 Sep 2020 14:44:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A45CD1D646; Thu, 17 Sep 2020 14:44:03 +0200 (CEST) Received: from huawei.com (szxga02-in.huawei.com [45.249.212.188]) by dpdk.org (Postfix) with ESMTP id 26BD91D607; Thu, 17 Sep 2020 14:43:59 +0200 (CEST) Received: from DGGEMM406-HUB.china.huawei.com (unknown [172.30.72.53]) by Forcepoint Email with ESMTP id 7F9B1B2881DC869EC0C7; Thu, 17 Sep 2020 20:43:58 +0800 (CST) Received: from DGGEMM533-MBX.china.huawei.com ([169.254.5.42]) by DGGEMM406-HUB.china.huawei.com ([10.3.20.214]) with mapi id 14.03.0487.000; Thu, 17 Sep 2020 20:43:48 +0800 From: wangyunjian To: "dev@dpdk.org" CC: "hemant.agrawal@nxp.com" , "sachin.saxena@nxp.com" , "anatoly.burakov@intel.com" , "Lilijun (Jerry)" , xudingke , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 2/2] bus/fslmc: fix check for vfio_group_fd Thread-Index: AQHWLY+CWhZJif0t00euztFJhPnQN6ltgzwQ Date: Thu, 17 Sep 2020 12:43:47 +0000 Message-ID: <34EFBCA9F01B0748BEB6B629CE643AE60DA5142D@DGGEMM533-MBX.china.huawei.com> References: <1589859732-5008-1-git-send-email-wangyunjian@huawei.com> In-Reply-To: <1589859732-5008-1-git-send-email-wangyunjian@huawei.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.185.168] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 2/2] bus/fslmc: fix check for vfio_group_fd X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Friendly ping > -----Original Message----- > From: wangyunjian > Sent: Tuesday, May 19, 2020 11:42 AM > To: dev@dpdk.org > Cc: anatoly.burakov@intel.com; hemant.agrawal@nxp.com; > sachin.saxena@nxp.com; Lilijun (Jerry) ; xuding= ke > ; wangyunjian ; > stable@dpdk.org > Subject: [dpdk-dev] [PATCH 2/2] bus/fslmc: fix check for vfio_group_fd >=20 > From: Yunjian Wang >=20 > The issue is that a file descriptor at 0 is a valid one. Currently the fi= le not found, > the return value will be set to 0. As a result, it is impossible to disti= nguish > between a correct descriptor and a failed return value. Fix it to return = -ENOENT > instead of 0. >=20 > Fixes: a69f79300262 ("bus/fslmc: support multi VFIO group") > Cc: stable@dpdk.org >=20 > Signed-off-by: Yunjian Wang > --- > drivers/bus/fslmc/fslmc_vfio.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfi= o.c index > 970969d2b..04ccf4af6 100644 > --- a/drivers/bus/fslmc/fslmc_vfio.c > +++ b/drivers/bus/fslmc/fslmc_vfio.c > @@ -448,11 +448,14 @@ fslmc_vfio_setup_device(const char *sysfs_base, > const char *dev_addr, >=20 > /* get the actual group fd */ > vfio_group_fd =3D rte_vfio_get_group_fd(iommu_group_no); > - if (vfio_group_fd < 0) > + if (vfio_group_fd < 0 && vfio_group_fd !=3D -ENOENT) > return -1; >=20 > - /* if group_fd =3D=3D 0, that means the device isn't managed by VFIO */ > - if (vfio_group_fd =3D=3D 0) { > + /* > + * if vfio_group_fd =3D=3D -ENOENT, that means the device > + * isn't managed by VFIO > + */ > + if (vfio_group_fd =3D=3D -ENOENT) { > RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver, > skipping\n", > dev_addr); > return 1; > -- > 2.23.0 >=20