diff mbox

[2/2] vhost: fix incorrect check in vhost_verify_ring_mappings

Message ID 1519810529-4034-2-git-send-email-hejianet@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jia He Feb. 28, 2018, 9:35 a.m. UTC
In commit 0ca1fd2d6878 ("vhost: Simplify ring verification checks"),
it checks the virtqueue desc mapping for 3 times.

Fixed: commit 0ca1fd2d6878 ("vhost: Simplify ring verification checks")
Signed-off-by: Jia He <jia.he@hxt-semitech.com>
---
 hw/virtio/vhost.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Dr. David Alan Gilbert Feb. 28, 2018, 7 p.m. UTC | #1
* Jia He (hejianet@gmail.com) wrote:
> In commit 0ca1fd2d6878 ("vhost: Simplify ring verification checks"),
> it checks the virtqueue desc mapping for 3 times.
> 
> Fixed: commit 0ca1fd2d6878 ("vhost: Simplify ring verification checks")
> Signed-off-by: Jia He <jia.he@hxt-semitech.com>

Oops, well spotted; copy & paste strikes again.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hw/virtio/vhost.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 00f2512..bbf6c0c 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -359,7 +359,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev,
>  
>          j++;
>          r = vhost_verify_ring_part_mapping(
> -                vq->desc, vq->desc_phys, vq->desc_size,
> +                vq->avail, vq->avail_phys, vq->avail_size,
>                  reg_hva, reg_gpa, reg_size);
>          if (r) {
>              break;
> @@ -367,7 +367,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev,
>  
>          j++;
>          r = vhost_verify_ring_part_mapping(
> -                vq->desc, vq->desc_phys, vq->desc_size,
> +                vq->used, vq->used_phys, vq->used_size,
>                  reg_hva, reg_gpa, reg_size);
>          if (r) {
>              break;
> -- 
> 2.7.4
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox

Patch

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 00f2512..bbf6c0c 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -359,7 +359,7 @@  static int vhost_verify_ring_mappings(struct vhost_dev *dev,
 
         j++;
         r = vhost_verify_ring_part_mapping(
-                vq->desc, vq->desc_phys, vq->desc_size,
+                vq->avail, vq->avail_phys, vq->avail_size,
                 reg_hva, reg_gpa, reg_size);
         if (r) {
             break;
@@ -367,7 +367,7 @@  static int vhost_verify_ring_mappings(struct vhost_dev *dev,
 
         j++;
         r = vhost_verify_ring_part_mapping(
-                vq->desc, vq->desc_phys, vq->desc_size,
+                vq->used, vq->used_phys, vq->used_size,
                 reg_hva, reg_gpa, reg_size);
         if (r) {
             break;