[dpdk-dev] [PATCH 2/2] bus/fslmc: fix check for vfio_group_fd

wangyunjian wangyunjian at huawei.com
Thu Sep 17 15:34:34 CEST 2020


> -----Original Message-----
> From: Burakov, Anatoly [mailto:anatoly.burakov at intel.com]
> Sent: Thursday, September 17, 2020 8:56 PM
> To: wangyunjian <wangyunjian at huawei.com>; dev at dpdk.org
> Cc: hemant.agrawal at nxp.com; sachin.saxena at nxp.com; Lilijun (Jerry)
> <jerry.lilijun at huawei.com>; xudingke <xudingke at huawei.com>;
> stable at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 2/2] bus/fslmc: fix check for vfio_group_fd
> 
> On 19-May-20 4:42 AM, wangyunjian wrote:
> > From: Yunjian Wang <wangyunjian at huawei.com>
> >
> > The issue is that a file descriptor at 0 is a valid one. Currently the
> > file not found, the return value will be set to 0. As a result, it is
> > impossible to distinguish between a correct descriptor and a failed
> > return value. Fix it to return -ENOENT instead of 0.
> >
> > Fixes: a69f79300262 ("bus/fslmc: support multi VFIO group")
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
> > ---
> 
> I am unfamiliar with bus/fslmc code but i've taken a quick look, and i've noticed
> that there's another instance of get_group_fd() usage that you're not
> modifying - is that intentional?

Thank you for your review. The another instance of get_group_fd(), is this it?
int
fslmc_vfio_setup_group(void) {
    ...
	/* Get the actual group fd */
	ret = rte_vfio_get_group_fd(groupid);
	if (ret < 0)
		return ret;
	vfio_group.fd = ret;
    ...
}
I don't think this's necessary. Because it must be a valid descriptor before it can be used.

Yunjian

> 
> --
> Thanks,
> Anatoly


More information about the dev mailing list