[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] virtio: Fix wrong type cast from pointer to long
From: |
Stefan Weil |
Subject: |
[Qemu-devel] [PATCH] virtio: Fix wrong type cast from pointer to long |
Date: |
Wed, 24 Sep 2014 07:20:02 +0200 |
Compiler warning (w32, w64):
include/hw/virtio/virtio_ring.h:142:26: warning:
cast from pointer to integer of different size [-Wpointer-to-int-cast]
When sizeof(long) < sizeof(void *), this is not only a warning but a
real program error.
Add also missing blanks in the same statement.
Signed-off-by: Stefan Weil <address@hidden>
---
Peter, could you please apply this bug fix directly without pull request?
Thanks
Stefan
include/hw/virtio/virtio_ring.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/hw/virtio/virtio_ring.h b/include/hw/virtio/virtio_ring.h
index 8f58bc9..0b42e6e 100644
--- a/include/hw/virtio/virtio_ring.h
+++ b/include/hw/virtio/virtio_ring.h
@@ -139,8 +139,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_desc);
- vr->used = (void *)(((unsigned long)&vr->avail->ring[num] +
sizeof(uint16_t)
- + align-1) & ~(align - 1));
+ vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(uint16_t)
+ + align - 1) & ~(align - 1));
}
static inline unsigned vring_size(unsigned int num, unsigned long align)
--
1.7.10.4
- [Qemu-devel] [PATCH] virtio: Fix wrong type cast from pointer to long,
Stefan Weil <=