Received: from eggs.gnu.org ([2001:4830:134:3::10]:59269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqSY0-0004rB-8d for qemu-devel@nongnu.org; Tue, 21 Mar 2017 18:46:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqSXv-0003Uh-Dg for qemu-devel@nongnu.org; Tue, 21 Mar 2017 18:46:36 -0400 Received: from mail-bn3nam01on0137.outbound.protection.outlook.com ([104.47.33.137]:11979 helo=NAM01-BN3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqSXu-0003Ua-TK for qemu-devel@nongnu.org; Tue, 21 Mar 2017 18:46:31 -0400 From: Andrew Baumann Date: Tue, 21 Mar 2017 15:31:51 -0700 Message-Id: <20170321223151.12984-1-Andrew.Baumann@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH] virtio: fix vring_align() on 64-bit win32 platforms List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Michael S . Tsirkin" , Stefan Weil , Andrew Baumann "long" is 32-bits on win32, but we need to promote it to a 64-bit hwaddr before negating, or else the top half of the address is truncated Signed-off-by: Andrew Baumann --- include/hw/virtio/virtio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 15efcf2..a0a8543 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -34,7 +34,7 @@ struct VirtQueue; static inline hwaddr vring_align(hwaddr addr, unsigned long align) { - return (addr + align - 1) & ~(align - 1); + return (addr + align - 1) & ~(hwaddr)(align - 1); } typedef struct VirtQueue VirtQueue; -- 2.7.4