virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][VIRTIO] Fix vring_init() ring computations
@ 2007-11-07  2:52 Anthony Liguori
  2007-11-07  5:57 ` Rusty Russell
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2007-11-07  2:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: Anthony Liguori, Rusty Russell, virtualization

This patch fixes a typo in vring_init().  This happens to work today in lguest
because the sizeof(struct vring_desc) is 16 and struct vring contains 3
pointers and an unsigned int so on 32-bit
sizeof(struct vring_desc) == sizeof(struct vring).  However, this is no longer
true on 64-bit where the bug is exposed.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index ac69e7b..5b88d21 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -92,8 +92,8 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p)
 {
 	vr->num = num;
 	vr->desc = p;
-	vr->avail = p + num*sizeof(struct vring);
-	vr->used = p + (num+1)*(sizeof(struct vring) + sizeof(__u16));
+	vr->avail = p + num*sizeof(struct vring_desc);
+	vr->used = p + (num+1)*(sizeof(struct vring_desc) + sizeof(__u16));
 }
 
 static inline unsigned vring_size(unsigned int num)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH][VIRTIO] Fix vring_init() ring computations
  2007-11-07  2:52 [PATCH][VIRTIO] Fix vring_init() ring computations Anthony Liguori
@ 2007-11-07  5:57 ` Rusty Russell
  2007-11-08  1:06   ` Anthony Liguori
  0 siblings, 1 reply; 4+ messages in thread
From: Rusty Russell @ 2007-11-07  5:57 UTC (permalink / raw)
  To: virtualization
  Cc: Anthony Liguori, linux-kernel, Rusty Russell, virtualization

On Wednesday 07 November 2007 13:52:29 Anthony Liguori wrote:
> This patch fixes a typo in vring_init(). 

Thanks, applied.

I've put it in the new, experimental virtio git tree on git.kernel.org.

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][VIRTIO] Fix vring_init() ring computations
  2007-11-07  5:57 ` Rusty Russell
@ 2007-11-08  1:06   ` Anthony Liguori
  2007-11-08  2:25     ` Rusty Russell
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2007-11-08  1:06 UTC (permalink / raw)
  To: Rusty Russell; +Cc: virtualization, linux-kernel, Rusty Russell, virtualization

Rusty Russell wrote:
> On Wednesday 07 November 2007 13:52:29 Anthony Liguori wrote:
>   
>> This patch fixes a typo in vring_init(). 
>>     
>
> Thanks, applied.
>
> I've put it in the new, experimental virtio git tree on git.kernel.org.
>   

Hrm, perhaps you forgot to push?  I don't see it in the tree although I 
see the config ops refactoring.

Regards,

Anthony Liguori

> Cheers,
> Rusty.
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][VIRTIO] Fix vring_init() ring computations
  2007-11-08  1:06   ` Anthony Liguori
@ 2007-11-08  2:25     ` Rusty Russell
  0 siblings, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2007-11-08  2:25 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: virtualization, linux-kernel, Rusty Russell, virtualization

On Thursday 08 November 2007 12:06:07 Anthony Liguori wrote:
> Rusty Russell wrote:
> > On Wednesday 07 November 2007 13:52:29 Anthony Liguori wrote:
> >> This patch fixes a typo in vring_init().
> >
> > Thanks, applied.
> >
> > I've put it in the new, experimental virtio git tree on git.kernel.org.
>
> Hrm, perhaps you forgot to push?  I don't see it in the tree although I
> see the config ops refactoring.

It should be in the patches/1 branch.  I've pushed again...

Thanks,
Rusty.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-08  2:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07  2:52 [PATCH][VIRTIO] Fix vring_init() ring computations Anthony Liguori
2007-11-07  5:57 ` Rusty Russell
2007-11-08  1:06   ` Anthony Liguori
2007-11-08  2:25     ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).