-----Original Message----- From: Andi Shyti <[email protected]> Sent: Tuesday, September 23, 2025 2:00 PM To: Cavitt, Jonathan <[email protected]> Cc: [email protected]; Gupta, saurabhg <[email protected]>; Zuo, Alex <[email protected]>; [email protected] 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; >
