From 0a061dc1bc9b635a3d03fc88f9fcb41c95d3f738 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Date: Fri, 23 Jul 2010 15:25:58 -0300
Subject: [PATCH] vhost_dev_unassign_memory() don't assert if removing first entry in list.

RH-Author: Jes Sorensen <Jes.Sorensen@redhat.com>
Message-id: <1279898758-7397-2-git-send-email-Jes.Sorensen@redhat.com>
Patchwork-id: 10947
O-Subject: [RHEL6 qemu-kvm PATCH 1/1] vhost_dev_unassign_memory() don't assert
	if removing first entry in list.
Bugzilla: 617085
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
RH-Acked-by: Don Dutile <ddutile@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

If removing an entry from the list which is fully included in the
region and this is the first entry in the list. In this case 'to' can
go to -1, which is perfectly valid. Don't assert() on this case.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 hw/vhost.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/vhost.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/hw/vhost.c b/hw/vhost.c
index 3c1c702..82a7c8e 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;
         }
-- 
1.7.0.3

