> 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.