It has no sense to call get_status twice, since we already have a
variable for that.
Signed-off-by: Eugenio Pérez <[email protected]>
---
drivers/vhost/vdpa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 01c59ce7e250..10676ea0348b 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -167,13 +167,13 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
status_old = ops->get_status(vdpa);
/*
* Userspace shouldn't remove status bits unless reset the
* status to 0.
*/
- if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
+ if (status != 0 && (status_old & ~status) != 0)
return -EINVAL;
if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
for (i = 0; i < nvqs; i++)
vhost_vdpa_unsetup_vq_irq(v, i);
--
2.27.0
On Fri, Nov 5, 2021 at 3:58 AM Eugenio Pérez <[email protected]> wrote:
>
> It has no sense to call get_status twice, since we already have a
> variable for that.
>
> Signed-off-by: Eugenio Pérez <[email protected]>
Acked-by: Jason Wang <[email protected]>
> ---
> drivers/vhost/vdpa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 01c59ce7e250..10676ea0348b 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -167,13 +167,13 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
> status_old = ops->get_status(vdpa);
>
> /*
> * Userspace shouldn't remove status bits unless reset the
> * status to 0.
> */
> - if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
> + if (status != 0 && (status_old & ~status) != 0)
> return -EINVAL;
>
> if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
> for (i = 0; i < nvqs; i++)
> vhost_vdpa_unsetup_vq_irq(v, i);
>
> --
> 2.27.0
>
On Thu, Nov 04, 2021 at 08:58:33PM +0100, Eugenio P?rez wrote:
>It has no sense to call get_status twice, since we already have a
>variable for that.
>
>Signed-off-by: Eugenio P?rez <[email protected]>
>---
> drivers/vhost/vdpa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
>index 01c59ce7e250..10676ea0348b 100644
>--- a/drivers/vhost/vdpa.c
>+++ b/drivers/vhost/vdpa.c
>@@ -167,13 +167,13 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
> status_old = ops->get_status(vdpa);
>
> /*
> * Userspace shouldn't remove status bits unless reset the
> * status to 0.
> */
>- if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
>+ if (status != 0 && (status_old & ~status) != 0)
> return -EINVAL;
>
> if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
> for (i = 0; i < nvqs; i++)
> vhost_vdpa_unsetup_vq_irq(v, i);
>
>--
>2.27.0
>
Reviewed-by: Stefano Garzarella <[email protected]>