From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L2ojn-0002Xv-Vg for qemu-devel@nongnu.org; Wed, 19 Nov 2008 10:13:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L2ojm-0002WG-Jd for qemu-devel@nongnu.org; Wed, 19 Nov 2008 10:13:03 -0500 Received: from [199.232.76.173] (port=34720 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2ojl-0002Vy-QR for qemu-devel@nongnu.org; Wed, 19 Nov 2008 10:13:01 -0500 Received: from wa-out-1112.google.com ([209.85.146.182]:1081) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L2ojl-0004mC-15 for qemu-devel@nongnu.org; Wed, 19 Nov 2008 10:13:01 -0500 Received: by wa-out-1112.google.com with SMTP id j5so4689572wah.18 for ; Wed, 19 Nov 2008 07:12:59 -0800 (PST) Message-ID: <49242CF6.2080200@codemonkey.ws> Date: Wed, 19 Nov 2008 09:12:54 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] fix warnings on i386 build References: <1227107680-8103-1-git-send-email-glommer@redhat.com> In-Reply-To: <1227107680-8103-1-git-send-email-glommer@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Glauber Costa wrote: > i386 builds of kvm shouts warnings about type mismatches > this patch fixes them. > > Signed-off-by: Glauber Costa > --- > kvm-all.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kvm-all.c b/kvm-all.c > index 18e9361..d3fcf8b 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -338,7 +338,7 @@ void kvm_set_phys_mem(target_phys_addr_t start_addr, > > /* Not splitting */ > if ((phys_offset - (start_addr - mem->guest_phys_addr)) == > - ((uint8_t *)mem->userspace_addr - phys_ram_base)) > + (mem->userspace_addr - (ram_addr_t)phys_ram_base)) > This isn't quite right. There's no reason ram_addr_t has to be 64-bit. If it were 32-bit, this would break badly. I think a better fix is: (ram_addr_t)((uint8_t *)mem->userspace_addr - phys_ram_base)) A proper fix would probably be to introduce a real KVMSlot structure that used the proper types instead of uint64_t. Regards, Anthony Liguori > return; > > /* unregister whole slot */ > @@ -349,7 +349,7 @@ void kvm_set_phys_mem(target_phys_addr_t start_addr, > /* register prefix slot */ > mem_start = slot.guest_phys_addr; > mem_size = start_addr - slot.guest_phys_addr; > - mem_offset = (uint8_t *)slot.userspace_addr - phys_ram_base; > + mem_offset = slot.userspace_addr - (ram_addr_t)phys_ram_base; > if (mem_size) > kvm_set_phys_mem(mem_start, mem_size, mem_offset); > >