From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50000 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdHVB-0007WJ-Rk for qemu-devel@nongnu.org; Mon, 26 Jul 2010 02:49:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdHV6-0002xO-RH for qemu-devel@nongnu.org; Mon, 26 Jul 2010 02:49:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27008) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdHV6-0002wr-Kk for qemu-devel@nongnu.org; Mon, 26 Jul 2010 02:49:24 -0400 Message-ID: <4C4D2FEF.50106@redhat.com> Date: Mon, 26 Jul 2010 08:49:19 +0200 From: Jes Sorensen MIME-Version: 1.0 References: <1279898202-7223-1-git-send-email-Jes.Sorensen@redhat.com> <20100724190300.GB3728@redhat.com> In-Reply-To: <20100724190300.GB3728@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] vhost_dev_unassign_memory() don't assert if removing first entry in list. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org On 07/24/10 21:03, Michael S. Tsirkin wrote: > On Fri, Jul 23, 2010 at 05:16:42PM +0200, Jes.Sorensen@redhat.com wrote: >> From: Jes Sorensen >> diff --git a/hw/vhost.c b/hw/vhost.c >> index d37a66e..f30cf91 100644 >> --- a/hw/vhost.c >> +++ b/hw/vhost.c >> @@ -119,7 +119,6 @@ static void vhost_dev_unassign_memory(struct vhost_dev *dev, >> if (start_addr <= reg->guest_phys_addr && memlast >= reglast) { >> --dev->mem->nregions; >> --to; >> - assert(to >= 0); >> ++overlap_middle; >> continue; >> } > > Good catch. > I think I must have meant dev->mem->nregions >= 0. Does this work > if you put in that assertion, or did I miss something else? It should work, but I don't see the point in adding the assert for that case since the loop shouldn't be able to run down to nregions < 0. Cheers, Jes