On Thu, Jul 30, 2015 at 12:11:59PM +0200, Igor Mammedov wrote: > Signed-off-by: Igor Mammedov <imamm...@redhat.com> > --- > hw/virtio/vhost.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index bcbad48..48fbac1 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c > @@ -985,6 +985,12 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, > hdev->started = false; > hdev->memory_changed = false; > memory_listener_register(&hdev->memory_listener, &address_space_memory); > + if (!vhost_has_free_slot()) {
I think this one needs a different test: we are not adding a new slot so just checking <= there should be enough. > + fprintf(stderr, "vhost backend memory slots limit is less" > + " than current number of present memory slots\n"); > + vhost_dev_cleanup(hdev); > + return -1; > + } > return 0; > fail_vq: > while (--i >= 0) { > -- > 1.8.3.1