Re: [PATCH 2/4] vfio: use __aligned_u64 in struct vfio_device_gfx_plane_info
From: Stefan Hajnoczi
Date: Tue Aug 15 2023 - 08:40:17 EST
On Mon, Aug 14, 2023 at 02:50:40PM -0300, Jason Gunthorpe wrote:
> On Wed, Aug 09, 2023 at 05:02:46PM -0400, Stefan Hajnoczi wrote:
> > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > index de675d799c7d..ffab3536dc8a 100644
> > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > @@ -1382,7 +1382,7 @@ static long intel_vgpu_ioctl(struct vfio_device *vfio_dev, unsigned int cmd,
> > intel_gvt_reset_vgpu(vgpu);
> > return 0;
> > } else if (cmd == VFIO_DEVICE_QUERY_GFX_PLANE) {
> > - struct vfio_device_gfx_plane_info dmabuf;
> > + struct vfio_device_gfx_plane_info dmabuf = {};
> > int ret = 0;
> >
> > minsz = offsetofend(struct vfio_device_gfx_plane_info,
> > @@ -1392,6 +1392,8 @@ static long intel_vgpu_ioctl(struct vfio_device *vfio_dev, unsigned int cmd,
> > if (dmabuf.argsz < minsz)
> > return -EINVAL;
> >
> > + minsz = min(minsz, sizeof(dmabuf));
> > +
>
> Huh?
>
> minsz = min(sizeof(dmabuf), dmabuf.argsz)
Thanks for catching this. I will fix it in the next revision.
Stefan
Attachment:
signature.asc
Description: PGP signature