Wang Sheng-Hui
2011-Aug-27 01:07 UTC
[PATCH] virtio: fix size computation according to the definition of struct vring_used in vring_size
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 at 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 at crossover-plinux:~/dev/patchwork$
Wanlong Gao
2011-Aug-27 02:49 UTC
[PATCH] virtio: fix size computation according to the definition of struct vring_used in vring_size
On Sat, 2011-08-27 at 09:07 +0800, Wang Sheng-Hui wrote:> 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 at 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 */Hi: I'm not deep into it, but I think you can see this: http://marc.info/?l=git-commits-head&m=130687915816130&w=2 Thanks -Wanlong Gao
Apparently Analagous Threads
- [PATCH] virtio: fix size computation according to the definition of struct vring_used in vring_size
- [PATCH] virtio: fix typo in vring_need_event() doc comment
- [PATCH] virtio: fix typo in vring_need_event() doc comment
- [RFC 2/3] virtio_ring: add VIRTIO_RING_NO_LEGACY
- [PATCH] btrfs-progs: avoid memory leak in btrfs_close_devices