public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio: fix size computation according to the definition of struct vring_used in vring_size
@ 2011-08-27  1:07 Wang Sheng-Hui
  2011-08-27  2:49 ` Wanlong Gao
  0 siblings, 1 reply; 10+ messages in thread
From: Wang Sheng-Hui @ 2011-08-27  1:07 UTC (permalink / raw)
  To: rusty, mst, virtualization, linux-kernel

The patch is against 3.1-rc3.

struct vring_used has two __u16 fields plus array of struct vring_used_elem.
Current vring_size counts the __u16 fields to 3. Fix it to 2 in the patch.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
 include/linux/virtio_ring.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 4a32cb6..fcda152 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -143,7 +143,7 @@ static inline unsigned vring_size(unsigned int num, unsigned long align)
 {
 	return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
 		 + align - 1) & ~(align - 1))
-		+ sizeof(__u16) * 3 + sizeof(struct vring_used_elem) * num;
+		+ sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num;
 }
 
 /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */
-- 
1.7.1

crossover@crossover-plinux:~/dev/patchwork$ 

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

end of thread, other threads:[~2011-08-30  0:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-27  1:07 [PATCH] virtio: fix size computation according to the definition of struct vring_used in vring_size Wang Sheng-Hui
2011-08-27  2:49 ` Wanlong Gao
2011-08-27  9:34   ` Wang Sheng-Hui
2011-08-27  9:52     ` Wang Sheng-Hui
2011-08-28 11:31       ` Michael S. Tsirkin
2011-08-28 12:48         ` Wang Sheng-Hui
2011-08-29  2:53       ` Rusty Russell
2011-08-29  6:51         ` Wang Sheng-Hui
2011-08-29  7:55         ` Wang Sheng-Hui
2011-08-30  0:12           ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox