public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] virtio: Fix typecast of pointer in vring_init()
@ 2015-07-02  7:21 Thomas Huth
  2015-07-05 10:58 ` Michael S. Tsirkin
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Huth @ 2015-07-02  7:21 UTC (permalink / raw)
  To: Michael S. Tsirkin, virtualization; +Cc: linux-api, linux-kernel

The virtio_ring.h header is used in userspace programs (ie. QEMU),
too. Here we can not assume that sizeof(pointer) is the same as
sizeof(long), e.g. when compiling for Windows, so the typecast in
vring_init() should be done with (uintptr_t) instead of (unsigned long).

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/uapi/linux/virtio_ring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
index 915980a..8682551 100644
--- a/include/uapi/linux/virtio_ring.h
+++ b/include/uapi/linux/virtio_ring.h
@@ -143,7 +143,7 @@ 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_desc);
-	vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__virtio16)
+	vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16)
 		+ align-1) & ~(align - 1));
 }
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-06 10:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-02  7:21 [PATCH RESEND] virtio: Fix typecast of pointer in vring_init() Thomas Huth
2015-07-05 10:58 ` Michael S. Tsirkin
2015-07-05 12:59   ` Michael S. Tsirkin
2015-07-06  9:24     ` Thomas Huth
2015-07-06  9:50       ` Michael S. Tsirkin
2015-07-06 10:05         ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox