From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S39Pf-0004Ly-Vu for qemu-devel@nongnu.org; Thu, 01 Mar 2012 12:03:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S39PZ-0004fc-R9 for qemu-devel@nongnu.org; Thu, 01 Mar 2012 12:03:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S39PZ-0004fV-Iu for qemu-devel@nongnu.org; Thu, 01 Mar 2012 12:03:25 -0500 Message-ID: <4F4FABD7.1030709@redhat.com> Date: Thu, 01 Mar 2012 19:03:19 +0200 From: Avi Kivity MIME-Version: 1.0 References: <4F4F7C47.6090005@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL] Urgent memory fix for kvm with unaligned memory slots List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bobby Powers Cc: qemu-devel , Anthony Liguori , KVM list On 03/01/2012 06:51 PM, Bobby Powers wrote: > > /* kvm works in page size chunks, but the function may be called > > with sub-page size and unaligned start address. */ > > - size = TARGET_PAGE_ALIGN(size); > > - start_addr = TARGET_PAGE_ALIGN(start_addr); > > + delta = TARGET_PAGE_ALIGN(size) - size; > > + if (delta > size) { > > + return; > > + } > > + start_addr += delta; > > + size -= delta; > > + size &= TARGET_PAGE_MASK; > > + if (!size || (start_addr & ~TARGET_PAGE_MASK)) { > > + return; > > + } > > > > if (!memory_region_is_ram(mr)) { > > return; > > } > > > > - ram = memory_region_get_ram_ptr(mr) + section->offset_within_region; > > + ram = memory_region_get_ram_ptr(mr) + section->offset_within_region > > + delta; > > Am I crazy, or does this look wrong? Could be both. Why do you thing it is wrong? -- error compiling committee.c: too many arguments to function