lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 10 Nov 2022 13:19:45 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     "Michael S. Tsirkin" <mst@...hat.com>
Cc:     Angus Chen <angus.chen@...uarmicro.com>,
        "virtualization@...ts.linux-foundation.org" 
        <virtualization@...ts.linux-foundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "lingshan.zhu@...el.com" <lingshan.zhu@...el.com>
Subject: Re: [PATCH] virtio_pci: modify ENOENT to EINVAL

On Thu, Nov 10, 2022 at 1:04 PM Michael S. Tsirkin <mst@...hat.com> wrote:
>
> On Thu, Nov 10, 2022 at 03:30:59AM +0000, Angus Chen wrote:
> > Hi Jason.
> >
> > > -----Original Message-----
> > > From: Jason Wang <jasowang@...hat.com>
> > > Sent: Wednesday, November 2, 2022 1:34 PM
> > > To: Angus Chen <angus.chen@...uarmicro.com>
> > > Cc: mst@...hat.com; virtualization@...ts.linux-foundation.org;
> > > linux-kernel@...r.kernel.org; lingshan.zhu@...el.com
> > > Subject: Re: [PATCH] virtio_pci: modify ENOENT to EINVAL
> > >
> > > On Tue, Nov 1, 2022 at 7:17 PM Angus Chen <angus.chen@...uarmicro.com>
> > > wrote:
> > > >
> > > > Virtio_crypto use max_data_queues+1 to setup vqs,
> > > > we use vp_modern_get_num_queues to protect the vq range in setup_vq.
> > > > We could enter index >= vp_modern_get_num_queues(mdev) in setup_vq
> > > > if common->num_queues is not set well,and it return -ENOENT.
> > > > It is better to use -EINVAL instead.
> > >
> > > I'm not sure I get this. It would be better to describe:
> > >
> > > 1) what kind of issues can we see if we return -ENOENT
> > > 2) why -EINVAL can help in this case
> > >
> > > Thanks
> > Thank you for your reply.
> > We use a robot to test our dpu to get the return value of probe.
> >  We often get ENOENT form ' setup_vq ' function because of device error.
> > Most of time, my device can't handle queue_enable well.
> > This time,we get 'ENOENT' because the device set max_data_queues bigger than num_queues.
> >
> > I think EINVAL is used when the value of some parameter is wrong.
>
> I think I agree. Jason?

I'm fine with this then.

Thanks

>
> > Btw,it not a big deal,I can modify the robot to workaround.
> >
> > >
> > > >
> > > > Signed-off-by: Angus Chen <angus.chen@...uarmicro.com>
> > > > ---
> > > >  drivers/virtio/virtio_pci_modern.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/virtio/virtio_pci_modern.c
> > > b/drivers/virtio/virtio_pci_modern.c
> > > > index c3b9f2761849..edf2e18014cd 100644
> > > > --- a/drivers/virtio/virtio_pci_modern.c
> > > > +++ b/drivers/virtio/virtio_pci_modern.c
> > > > @@ -303,7 +303,7 @@ static struct virtqueue *setup_vq(struct
> > > virtio_pci_device *vp_dev,
> > > >         int err;
> > > >
> > > >         if (index >= vp_modern_get_num_queues(mdev))
> > > > -               return ERR_PTR(-ENOENT);
> > > > +               return ERR_PTR(-EINVAL);
> > > >
> > > >         /* Check if queue is either not available or already active. */
> > > >         num = vp_modern_get_queue_size(mdev, index);
> > > > --
> > > > 2.25.1
> > > >
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ