All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-scsi: Fix memory leak when realize failed
@ 2014-10-30 11:50 Fam Zheng
  2014-11-03  8:53 ` Max Reitz
  0 siblings, 1 reply; 4+ messages in thread
From: Fam Zheng @ 2014-10-30 11:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, stefanha, Michael S. Tsirkin

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 hw/scsi/virtio-scsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index a1725b8..4aae1e8 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -793,6 +793,7 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
         error_setg(errp, "Invalid number of queues (= %" PRId32 "), "
                          "must be a positive integer less than %d.",
                    s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX);
+        virtio_cleanup(vdev);
         return;
     }
     s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-scsi: Fix memory leak when realize failed
  2014-10-30 11:50 [Qemu-devel] [PATCH] virtio-scsi: Fix memory leak when realize failed Fam Zheng
@ 2014-11-03  8:53 ` Max Reitz
  2014-11-03  9:17   ` Fam Zheng
  0 siblings, 1 reply; 4+ messages in thread
From: Max Reitz @ 2014-11-03  8:53 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: Paolo Bonzini, stefanha, Michael S. Tsirkin

On 2014-10-30 at 12:50, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>   hw/scsi/virtio-scsi.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index a1725b8..4aae1e8 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -793,6 +793,7 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
>           error_setg(errp, "Invalid number of queues (= %" PRId32 "), "
>                            "must be a positive integer less than %d.",
>                      s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX);
> +        virtio_cleanup(vdev);
>           return;
>       }
>       s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));

The alternative would be to simply push virtio_init() below this check, 
but it's fine either way.

Reviewed-by: Max Reitz <mreitz@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-scsi: Fix memory leak when realize failed
  2014-11-03  8:53 ` Max Reitz
@ 2014-11-03  9:17   ` Fam Zheng
  2014-11-03  9:17     ` Max Reitz
  0 siblings, 1 reply; 4+ messages in thread
From: Fam Zheng @ 2014-11-03  9:17 UTC (permalink / raw)
  To: Max Reitz; +Cc: Paolo Bonzini, qemu-devel, stefanha, Michael S. Tsirkin

On Mon, 11/03 09:53, Max Reitz wrote:
> On 2014-10-30 at 12:50, Fam Zheng wrote:
> >Signed-off-by: Fam Zheng <famz@redhat.com>
> >---
> >  hw/scsi/virtio-scsi.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> >diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> >index a1725b8..4aae1e8 100644
> >--- a/hw/scsi/virtio-scsi.c
> >+++ b/hw/scsi/virtio-scsi.c
> >@@ -793,6 +793,7 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
> >          error_setg(errp, "Invalid number of queues (= %" PRId32 "), "
> >                           "must be a positive integer less than %d.",
> >                     s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX);
> >+        virtio_cleanup(vdev);
> >          return;
> >      }
> >      s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));
> 
> The alternative would be to simply push virtio_init() below this check, but
> it's fine either way.
> 
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> 

Thanks, Paolo has sent a PULL req for this:

http://lists.gnu.org/archive/html/qemu-devel/2014-10/msg04113.html

Fam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-scsi: Fix memory leak when realize failed
  2014-11-03  9:17   ` Fam Zheng
@ 2014-11-03  9:17     ` Max Reitz
  0 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2014-11-03  9:17 UTC (permalink / raw)
  To: Fam Zheng; +Cc: Paolo Bonzini, qemu-devel, stefanha, Michael S. Tsirkin

On 2014-11-03 at 10:17, Fam Zheng wrote:
> On Mon, 11/03 09:53, Max Reitz wrote:
>> On 2014-10-30 at 12:50, Fam Zheng wrote:
>>> Signed-off-by: Fam Zheng <famz@redhat.com>
>>> ---
>>>   hw/scsi/virtio-scsi.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
>>> index a1725b8..4aae1e8 100644
>>> --- a/hw/scsi/virtio-scsi.c
>>> +++ b/hw/scsi/virtio-scsi.c
>>> @@ -793,6 +793,7 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
>>>           error_setg(errp, "Invalid number of queues (= %" PRId32 "), "
>>>                            "must be a positive integer less than %d.",
>>>                      s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX);
>>> +        virtio_cleanup(vdev);
>>>           return;
>>>       }
>>>       s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));
>> The alternative would be to simply push virtio_init() below this check, but
>> it's fine either way.
>>
>> Reviewed-by: Max Reitz <mreitz@redhat.com>
>>
> Thanks, Paolo has sent a PULL req for this:
>
> http://lists.gnu.org/archive/html/qemu-devel/2014-10/msg04113.html
>
> Fam

Ah, okay. :-)

Max

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-03  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-30 11:50 [Qemu-devel] [PATCH] virtio-scsi: Fix memory leak when realize failed Fam Zheng
2014-11-03  8:53 ` Max Reitz
2014-11-03  9:17   ` Fam Zheng
2014-11-03  9:17     ` Max Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.