Received: from eggs.gnu.org ([2001:4830:134:3::10]:39280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWiDH-00030o-Rr for qemu-devel@nongnu.org; Wed, 24 Sep 2014 04:46:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWiDC-0001ad-Tu for qemu-devel@nongnu.org; Wed, 24 Sep 2014 04:46:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWiDC-0001aA-MA for qemu-devel@nongnu.org; Wed, 24 Sep 2014 04:46:10 -0400 Date: Wed, 24 Sep 2014 16:46:02 +0800 From: Fam Zheng Message-ID: <20140924084602.GA26365@fam-t430.nay.redhat.com> References: <1411536002-14088-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1411536002-14088-1-git-send-email-sw@weilnetz.de> Subject: Re: [Qemu-devel] [PATCH] virtio: Fix wrong type cast from pointer to long List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Peter Maydell , qemu-devel@nongnu.org, Paolo Bonzini On Wed, 09/24 07:20, Stefan Weil wrote: > 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 > --- > > 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 > That was from copy&paste /usr/include/linux/virtio_ring.h. The patch looks good to me, should linux also need this fix? Reviewed-by: Fam Zheng Fam