Skip to content

Commit

Permalink
virtio: Fix wrong type cast from pointer to long
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Message-id: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
stweil authored and pm215 committed Sep 24, 2014
1 parent ca976d1 commit c0f8968
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/hw/virtio/virtio_ring.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c0f8968

Please sign in to comment.