RE: [PATCH v10 3/6] iommufd: Add iommufd_access_change_ioas(_id) helpers

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

 



> From: Nicolin Chen <nicolinc@xxxxxxxxxx>
> Sent: Friday, July 28, 2023 12:37 PM
> 
> On Fri, Jul 28, 2023 at 04:23:03AM +0000, Tian, Kevin wrote:
> > > From: Nicolin Chen <nicolinc@xxxxxxxxxx>
> > > Sent: Friday, July 28, 2023 4:25 AM
> > >
> > > +static int iommufd_access_change_ioas(struct iommufd_access *access,
> > > +                                   struct iommufd_ioas *new_ioas)
> > > +{
> > > +     u32 iopt_access_list_id = access->iopt_access_list_id;
> > > +     struct iommufd_ioas *cur_ioas = access->ioas;
> > > +     int rc;
> > > +
> > > +     lockdep_assert_held(&access->ioas_lock);
> > > +
> > > +     /* We are racing with a concurrent detach, bail */
> > > +     if (cur_ioas != access->ioas_unpin)
> > > +             return -EBUSY;
> > > +
> > > +     if (IS_ERR(new_ioas))
> > > +             return PTR_ERR(new_ioas);
> >
> > iommufd_access_change_ioas_id() already checks errors.
> 
> I've thought about that: given that iommufd_access_change_ioas
> is a standalone API, though it's not used anywhere else at the
> moment, it might be safer to have this check again. Otherwise,
> we would need a line of comments saying that "caller must make
> sure that the input new_ioas is not holding an error code" or
> so?
> 

I don't think it's a common practice for the caller to pass in
an error pointer when it already knows it's an error...




[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