Re: [RFC v2 03/11] vfio: Set device->group in helper function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 29, 2022 at 02:04:01AM +0000, Tian, Kevin wrote:
> > From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> > Sent: Monday, November 28, 2022 5:17 PM
> > 
> > 
> > >> +static int vfio_device_set_group(struct vfio_device *device,
> > >> +				 enum vfio_group_type type)
> > >>   {
> > >> -	int ret;
> > >> +	struct vfio_group *group;
> > >> +
> > >> +	if (type == VFIO_IOMMU)
> > >> +		group = vfio_group_find_or_alloc(device->dev);
> > >> +	else
> > >> +		group = vfio_noiommu_group_alloc(device->dev, type);
> > >
> > > Do we need a WARN_ON(type == VFIO_NO_IOMMU)?
> > 
> > do you mean a heads-up to user? if so, there is already a warn in
> > vfio_group_find_or_alloc() and vfio_group_ioctl_get_device_fd()
> > 
> 
> I meant that VFIO_NO_IOMMU is not expected as a passed in type.
> It's implicitly handled by vfio_group_find_or_alloc() which calls
> vfio_noiommu_group_alloc() plus kernel taint.

The code is simple enough to check the two callers, I don't know if we
need a WARN_ON - and it isn't actually wrong to call
vfio_noiommu_group_alloc() for a VFIO_NO_IOMMU..

Jason



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux