aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/virtio_ring.h
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2007-12-20 19:17:47 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-02-04 07:49:59 -0500
commit3309daaad724dd08eb598bf9c12b7bb9daddd706 (patch)
tree7f0fb0e040d3bd0e5c88b4f025125cec566221ee /include/linux/virtio_ring.h
parentf957d1f05a1a20bc3b954877c6562a4d53d58bde (diff)
virtio: Fix vring_init/vring_size to take unsigned long
Using unsigned int resulted in silent truncation of the upper 32-bit on x86_64 resulting in an OOPS since the ring was being initialized wrong. Please reconsider my previous patch to just use PAGE_ALIGN(). Open coding this sort of stuff, no matter how simple it seems, is just asking for this sort of trouble. 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.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 8cde10e792c4..ea3be89a0e83 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -89,7 +89,7 @@ struct vring {
89 * }; 89 * };
90 */ 90 */
91static inline void vring_init(struct vring *vr, unsigned int num, void *p, 91static inline void vring_init(struct vring *vr, unsigned int num, void *p,
92 unsigned int pagesize) 92 unsigned long pagesize)
93{ 93{
94 vr->num = num; 94 vr->num = num;
95 vr->desc = p; 95 vr->desc = p;
@@ -98,7 +98,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
98 & ~(pagesize - 1)); 98 & ~(pagesize - 1));
99} 99}
100 100
101static inline unsigned vring_size(unsigned int num, unsigned int pagesize) 101static inline unsigned vring_size(unsigned int num, unsigned long pagesize)
102{ 102{
103 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) 103 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
104 + pagesize - 1) & ~(pagesize - 1)) 104 + pagesize - 1) & ~(pagesize - 1))