Re: [PATCH v3 01/10] vfio: Make vfio_unpin_pages() return void

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

 



On Tue, Jul 12, 2022 at 10:21:14AM -0400, Anthony Krowiak wrote:

> > +void vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn,
> > +                   int npage)
> >   {
> >       struct vfio_container *container;
> >       struct vfio_iommu_driver *driver;
> > -     int ret;
> > 
> > -     if (!user_pfn || !npage || !vfio_assert_device_open(device))
> > -             return -EINVAL;
> 
> 
> You left out the check for !user_pfn?

Yes. I mentioned in the commit log. And it's in response to Jason's
remark: https://lore.kernel.org/kvm/20220707192210.GC1705032@xxxxxxxxxx/

Btw, user_pfn is removed in one of the following patches anyway.
 
> > +static void vfio_iommu_type1_unpin_pages(void *iommu_data,
> > +                                      unsigned long *user_pfn, int npage)
> >   {
> >       struct vfio_iommu *iommu = iommu_data;
> >       bool do_accounting;
> >       int i;
> > 
> > -     if (!iommu || !user_pfn || npage <= 0)
> > -             return -EINVAL;
> 
> 
> Is there a reason the checks above were not checked for WARN_ON?

For pointers, same reason here.

For npage, it's checked in its caller vfio_unpin_pages -- mentioned
in the commit log too. The VFIO core is the only caller and it is
unlikely to change. On the other hand, the plan is to replace this
vfio_iommu_type1_unpin_pages with IOMMUFD implementation.



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux