diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2007-11-07 00:31:52 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-11-11 21:55:12 -0500 |
commit | 44332f7167dfb1ca04af96a2cff938c5e23433db (patch) | |
tree | f096fa66efcaa8b70629667d4252c152c81ef603 /include/linux/virtio_ring.h | |
parent | 6e800af233e0bdf108efb7bd23c11ea6fa34cdeb (diff) |
virtio: fix vring_init for 64 bits
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>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/virtio_ring.h')
-rw-r--r-- | include/linux/virtio_ring.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index ac69e7bb5a14..5b88d215af50 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) | |||
92 | { | 92 | { |
93 | vr->num = num; | 93 | vr->num = num; |
94 | vr->desc = p; | 94 | vr->desc = p; |
95 | vr->avail = p + num*sizeof(struct vring); | 95 | vr->avail = p + num*sizeof(struct vring_desc); |
96 | vr->used = p + (num+1)*(sizeof(struct vring) + sizeof(__u16)); | 96 | vr->used = p + (num+1)*(sizeof(struct vring_desc) + sizeof(__u16)); |
97 | } | 97 | } |
98 | 98 | ||
99 | static inline unsigned vring_size(unsigned int num) | 99 | static inline unsigned vring_size(unsigned int num) |