提交 44332f71 编写于 作者: A Anthony Liguori 提交者: Rusty Russell

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: NAnthony Liguori <aliguori@us.ibm.com>
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 6e800af2
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册