[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.4 v3 3/3] vhost: fail backend intializatio
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH for-2.4 v3 3/3] vhost: fail backend intialization if memslots number is more than its supported limit |
Date: |
Thu, 30 Jul 2015 18:29:49 +0300 |
On Thu, Jul 30, 2015 at 12:11:59PM +0200, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <address@hidden>
> ---
> 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