]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
virtio: Fix vring_init/vring_size to take unsigned long
authorAnthony Liguori <aliguori@us.ibm.com>
Fri, 21 Dec 2007 00:17:47 +0000 (02:17 +0200)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 4 Feb 2008 12:49:59 +0000 (23:49 +1100)
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>
include/linux/virtio_ring.h

index 8cde10e792c4c362077887d207a11249af603cd4..ea3be89a0e83c6d207870a66a0e61ba5b96eeff6 100644 (file)
@@ -89,7 +89,7 @@ struct vring {
  * };
  */
 static inline void vring_init(struct vring *vr, unsigned int num, void *p,
-                             unsigned int pagesize)
+                             unsigned long pagesize)
 {
        vr->num = num;
        vr->desc = p;
@@ -98,7 +98,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
                            & ~(pagesize - 1));
 }
 
-static inline unsigned vring_size(unsigned int num, unsigned int pagesize)
+static inline unsigned vring_size(unsigned int num, unsigned long pagesize)
 {
        return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
                 + pagesize - 1) & ~(pagesize - 1))