[PATCH-for-5.1] libvhost-user: Report descriptor index on panic

Philippe Mathieu-Daudé posted 1 patch 3 years, 9 months ago
Test docker-quick@centos7 failed
Test docker-mingw@fedora failed
Test checkpatch failed
Test FreeBSD failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200723171935.18535-1-philmd@redhat.com
contrib/libvhost-user/libvhost-user.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH-for-5.1] libvhost-user: Report descriptor index on panic
Posted by Philippe Mathieu-Daudé 3 years, 9 months ago
We want to report the index of the descriptor,
not its pointer.

Fixes: 7b2e5c65f4 ("contrib: add libvhost-user")
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 contrib/libvhost-user/libvhost-user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index d315db1396..53f16bdf08 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -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


Re: [PATCH-for-5.1] libvhost-user: Report descriptor index on panic
Posted by Marc-André Lureau 3 years, 9 months ago
On Thu, Jul 23, 2020 at 9:19 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> We want to report the index of the descriptor,
> not its pointer.
>
> Fixes: 7b2e5c65f4 ("contrib: add libvhost-user")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  contrib/libvhost-user/libvhost-user.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> index d315db1396..53f16bdf08 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -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
>


Re: [PATCH-for-5.1] libvhost-user: Report descriptor index on panic
Posted by Raphael Norwitz 3 years, 9 months ago
On Thu, Jul 23, 2020 at 11:20 AM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> We want to report the index of the descriptor,
> not its pointer.
>
> Fixes: 7b2e5c65f4 ("contrib: add libvhost-user")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>

> ---
>  contrib/libvhost-user/libvhost-user.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> index d315db1396..53f16bdf08 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -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
>
>

Re: [PATCH-for-5.1] libvhost-user: Report descriptor index on panic
Posted by Stefan Hajnoczi 3 years, 9 months ago
On Thu, Jul 23, 2020 at 07:19:35PM +0200, Philippe Mathieu-Daudé wrote:
> We want to report the index of the descriptor,
> not its pointer.
> 
> Fixes: 7b2e5c65f4 ("contrib: add libvhost-user")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  contrib/libvhost-user/libvhost-user.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>