Skip to contentSkip to conversation

libvhost-user: Report descriptor index on panic

PATCH-for-5.1 Philippe Mathieu-Daudé 4 participants 4 messages Jul 23, 2020 – Jul 24, 2020

lore
Share & tools
lore
#0 lore raw

We want to report the index of the descriptor,
not its pointer.

Fixes 7b2e5c65f4 ("contrib: add libvhost-user")
---
 contrib/libvhost-user/libvhost-user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/libvhost-user/libvhost-user.c +2 -2
index d315db1396..53f16bdf08 100644
@@ -2074,7 +2074,7 @@ virtqueue_get_head(VuDev *dev, VuVirtq *vq,
 
     /* If their number is silly, that's a fatal mistake. */
     if (*head >= vq->vring.num) {
-        vu_panic(dev, "Guest says index %u is available", head);
+        vu_panic(dev, "Guest says index %u is available", *head);
         return false;
     }
 
@@ -2133,7 +2133,7 @@ virtqueue_read_next_desc(VuDev *dev, struct vring_desc *desc,
     smp_wmb();
 
     if (*next >= max) {
-        vu_panic(dev, "Desc next is %u", next);
+        vu_panic(dev, "Desc next is %u", *next);
         return VIRTQUEUE_READ_DESC_ERROR;
     }
 
Signature · 1 line
2.21.3
Reviewed-by
#1 lore raw
Quoted 6 lines · Philippe Mathieu-Daudé

We want to report the index of the descriptor,
not its pointer.

Fixes 7b2e5c65f4 ("contrib: add libvhost-user")
Quoted 29 lines
---
 contrib/libvhost-user/libvhost-user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/libvhost-user/libvhost-user.c +2 -3
index d315db1396..53f16bdf08 100644
@@ -2074,7 +2074,7 @@ virtqueue_get_head(VuDev *dev, VuVirtq *vq,
 
     /* If their number is silly, that's a fatal mistake. */
     if (*head >= vq->vring.num) {
-        vu_panic(dev, "Guest says index %u is available", head);
+        vu_panic(dev, "Guest says index %u is available", *head);
         return false;
     }
 
@@ -2133,7 +2133,7 @@ virtqueue_read_next_desc(VuDev *dev, struct vring_desc *desc,
     smp_wmb();
 
     if (*next >= max) {
-        vu_panic(dev, "Desc next is %u", next);
+        vu_panic(dev, "Desc next is %u", *next);
         return VIRTQUEUE_READ_DESC_ERROR;
     }
 
--

2.21.3

Reviewed-by
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

We want to report the index of the descriptor,
not its pointer.

Fixes 7b2e5c65f4 ("contrib: add libvhost-user")
Quoted 30 lines
---
 contrib/libvhost-user/libvhost-user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/libvhost-user/libvhost-user.c +2 -3
index d315db1396..53f16bdf08 100644
@@ -2074,7 +2074,7 @@ virtqueue_get_head(VuDev *dev, VuVirtq *vq,
 
     /* If their number is silly, that's a fatal mistake. */
     if (*head >= vq->vring.num) {
-        vu_panic(dev, "Guest says index %u is available", head);
+        vu_panic(dev, "Guest says index %u is available", *head);
         return false;
     }
 
@@ -2133,7 +2133,7 @@ virtqueue_read_next_desc(VuDev *dev, struct vring_desc *desc,
     smp_wmb();
 
     if (*next >= max) {
-        vu_panic(dev, "Desc next is %u", next);
+        vu_panic(dev, "Desc next is %u", *next);
         return VIRTQUEUE_READ_DESC_ERROR;
     }
 
--

2.21.3