diff mbox

[1/3] virtio: Correct error message of unavailable index

Message ID 20110615142524.26726.13785.stgit@localhost6.localdomain6 (mailing list archive)
State New, archived
Headers show

Commit Message

Amos Kong June 15, 2011, 2:25 p.m. UTC
'head' is an index of VirtQueueElement, it should less than vring.num

Signed-off-by: Amos Kong <akong@redhat.com>
---
 hw/virtio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Michael S. Tsirkin June 15, 2011, 8:30 p.m. UTC | #1
On Wed, Jun 15, 2011 at 10:25:24PM +0800, Amos Kong wrote:
> 'head' is an index of VirtQueueElement, it should less than vring.num
> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  hw/virtio.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/virtio.c b/hw/virtio.c
> index 6e8814c..a3d0eee 100644
> --- a/hw/virtio.c
> +++ b/hw/virtio.c
> @@ -271,7 +271,7 @@ static unsigned int virtqueue_get_head(VirtQueue *vq, unsigned int idx)
>  
>      /* If their number is silly, that's a fatal mistake. */
>      if (head >= vq->vring.num) {
> -        error_report("Guest says index %u is available", head);
> +        error_report("Guest says index %u is unavailable", head);
>          exit(1);
>      }
>  

That does not seem right. So the message says that an illegal value
was made available - that is, put in the available ring.
The original message seems correct to me.
Amos Kong June 16, 2011, 1:59 a.m. UTC | #2
On Wed, Jun 15, 2011 at 11:30:32PM +0300, Michael S. Tsirkin wrote:
> On Wed, Jun 15, 2011 at 10:25:24PM +0800, Amos Kong wrote:
> > 'head' is an index of VirtQueueElement, it should less than vring.num
> > 
> > Signed-off-by: Amos Kong <akong@redhat.com>
> > ---
> >  hw/virtio.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/hw/virtio.c b/hw/virtio.c
> > index 6e8814c..a3d0eee 100644
> > --- a/hw/virtio.c
> > +++ b/hw/virtio.c
> > @@ -271,7 +271,7 @@ static unsigned int virtqueue_get_head(VirtQueue *vq, unsigned int idx)
> >  
> >      /* If their number is silly, that's a fatal mistake. */
> >      if (head >= vq->vring.num) {
> > -        error_report("Guest says index %u is available", head);
> > +        error_report("Guest says index %u is unavailable", head);
> >          exit(1);
> >      }
> >  
> 
> That does not seem right. So the message says that an illegal value
> was made available - that is, put in the available ring.
> The original message seems correct to me.

It's my misunderstanding, thanks for pointing this.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/hw/virtio.c b/hw/virtio.c
index 6e8814c..a3d0eee 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -271,7 +271,7 @@  static unsigned int virtqueue_get_head(VirtQueue *vq, unsigned int idx)
 
     /* If their number is silly, that's a fatal mistake. */
     if (head >= vq->vring.num) {
-        error_report("Guest says index %u is available", head);
+        error_report("Guest says index %u is unavailable", head);
         exit(1);
     }