[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJaqyWd1GjE5SqRi2kmbx=4qxRifvk6yiR8BOpEd+B3FqN3C=g@mail.gmail.com>
Date: Mon, 12 Jan 2026 13:09:19 +0100
From: Eugenio Perez Martin <eperezma@...hat.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: linux-kernel@...r.kernel.org, virtualization@...ts.linux.dev,
Maxime Coquelin <mcoqueli@...hat.com>, Laurent Vivier <lvivier@...hat.com>, Cindy Lu <lulu@...hat.com>,
jasowang@...hat.com, Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Stefano Garzarella <sgarzare@...hat.com>, Yongji Xie <xieyongji@...edance.com>
Subject: Re: [PATCH v11 02/12] vduse: add vq group support
On Mon, Jan 12, 2026 at 9:00 AM Michael S. Tsirkin <mst@...hat.com> wrote:
>
> On Mon, Jan 12, 2026 at 08:35:37AM +0100, Eugenio Perez Martin wrote:
> > On Sun, Jan 11, 2026 at 12:44 AM Michael S. Tsirkin <mst@...hat.com> wrote:
> > >
> > > On Fri, Jan 09, 2026 at 04:24:20PM +0100, Eugenio Pérez wrote:
> > > > @@ -1252,12 +1266,24 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
> > > > if (config.index >= dev->vq_num)
> > > > break;
> > > >
> > > > - if (!is_mem_zero((const char *)config.reserved,
> > > > - sizeof(config.reserved)))
> > > > + if (dev->api_version < VDUSE_API_VERSION_1 && config.group)
> > > > + break;
> >
> > (Bookmarking the piece of code above as [1] to reference later)
> >
> > > > +
> > > > + if (dev->api_version >= VDUSE_API_VERSION_1) {
> > > > + if (config.group >= dev->ngroups)
> > > > + break;
> > > > + if (dev->status & VIRTIO_CONFIG_S_DRIVER_OK)
> > > > + break;
> > > > + }
> > > > +
> > > > + if (config.reserved1 ||
> > > > + !is_mem_zero((const char *)config.reserved2,
> > > > + sizeof(config.reserved2)))
> > >
> > > Hmm but if api version is 0 then group should be 0 no?
> > > We should validate.
> > >
> >
> > The check (dev->api_version < VDUSE_API_VERSION_1 && config.group) is
> > above this check in this set of changes [1], am I missing something?
> > Would you prefer it to be reordered here or written differently?
>
>
> Oh you are right. It's just not very clear that everything is covered.
>
> if (dev->api_version < VDUSE_API_VERSION_1) {
> if (config.group)
> ....
> } else {
> ....
> }
>
>
> would be clearer.
>
>
> BTW I don't really like this idiom of "break to return".
> Just return -EINVAL would be more explicit.
>
I agree. Maybe if I change an entire case block I could move it to
return style in the future, case by case. Would that be ok?
> But this is the way current code handles it, so I'm not demanding
> it is changed as part of this patchset.
>
> --
> MST
>
Powered by blists - more mailing lists