-----Original Message-----
From: Andi Shyti <andi.sh...@kernel.org> 
Sent: Tuesday, September 23, 2025 2:00 PM
To: Cavitt, Jonathan <jonathan.cav...@intel.com>
Cc: intel-gfx@lists.freedesktop.org; Gupta, saurabhg 
<saurabhg.gu...@intel.com>; Zuo, Alex <alex....@intel.com>; 
andi.sh...@linux.intel.com
Subject: Re: [PATCH v2] drm/i915/gvt: Improve intel_vgpu_ioctl hdr error 
handling
> 
> Hi Jonathan,
> 
> ...
> 
> > @@ -1361,21 +1361,27 @@ static long intel_vgpu_ioctl(struct vfio_device 
> > *vfio_dev, unsigned int cmd,
> >             if (copy_from_user(&hdr, (void __user *)arg, minsz))
> >                     return -EFAULT;
> >  
> > +           if (hweight32(hdr.flags & VFIO_IRQ_SET_DATA_TYPE_MASK) != 1 ||
> > +               hweight32(hdr.flags & VFIO_IRQ_SET_ACTION_TYPE_MASK) != 1)
> 
> How about using:
> 
>     if (!is_power_of_2(...) ||
>         !is_power_of_2(...))
> 
> The rest looks good.

Hmm... Yeah, looking at it, that does seem a bit more efficient than what I
have here.  I don't know if it's worth spinning another revision of the
patch over, though.  Perhaps if it's considered worthwhile enough we
could just add it in at merge time?

Thoughts?
-Jonathan Cavitt

> 
> Andi
> 
> > +                   return -EINVAL;
> 

Reply via email to