qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for 3.1 3/4] virtio-scsi/migration: Allow load_r


From: Cornelia Huck
Subject: Re: [Qemu-devel] [PATCH for 3.1 3/4] virtio-scsi/migration: Allow load_request to fail
Date: Tue, 17 Jul 2018 11:13:40 +0200

On Mon, 16 Jul 2018 18:37:42 +0100
"Dr. David Alan Gilbert (git)" <address@hidden> wrote:

> From: "Dr. David Alan Gilbert" <address@hidden>
> 
> Rather than asserting, check values and return NULL
> on failure.
> 
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> ---
>  hw/scsi/virtio-scsi.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 6301af76ad..3441bfe6d7 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -204,7 +204,11 @@ static void *virtio_scsi_load_request(QEMUFile *f, 
> SCSIRequest *sreq)
>      uint32_t n;
>  
>      qemu_get_be32s(f, &n);
> -    assert(n < vs->conf.num_queues);
> +    if (n >= vs->conf.num_queues) {
> +        error_report("%s: Bad queue number (%d vs %d)",
> +                     __func__, n, vs->conf.num_queues);

Hm... "(%d, num_queues %d)" might be a bit clearer?

> +        return NULL;
> +    }
>      req = qemu_get_virtqueue_element(vdev, f,
>                                       sizeof(VirtIOSCSIReq) + vs->cdb_size);
>      if (!req) {

Still,
Reviewed-by: Cornelia Huck <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]