diff --git a/include/hw/virtio/virtio_ring.h b/include/hw/virtio/virtio_ring.h index 8f58bc975e..0b42e6eae5 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)