All of lore.kernel.org
 help / color / mirror / Atom feed
* [Virtio-for-kvm] [PATCH 9/13] [Mostly resend] virtio additions
@ 2007-12-21 15:25 Dor Laor
  0 siblings, 0 replies; only message in thread
From: Dor Laor @ 2007-12-21 15:25 UTC (permalink / raw)
  To: kvm-devel, virtualization, Anthony Liguori, Rusty Russell

 From e761e0d22af833c9d0d48f191f38fc25f6a5f753 Mon Sep 17 00:00:00 2001
From: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Date: Fri, 21 Dec 2007 02:17:47 +0200
Subject: [PATCH] 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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 include/linux/virtio_ring.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 1a4ed49..5de09f9 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -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))
-- 
1.5.3.3


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-21 15:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-21 15:25 [Virtio-for-kvm] [PATCH 9/13] [Mostly resend] virtio additions Dor Laor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.