qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio: don't ignore return value of migrate_add_blocker
@ 2019-11-14 13:34 Jens Freimann
  2019-11-14 13:39 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jens Freimann @ 2019-11-14 13:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.williamson

When an error occurs in migrate_add_blocker() it sets a
negative return value and uses error pointer we pass in.
Instead of just looking at the error pointer check for a negative return
value and avoid a coverity error because the return value is
set but never used. This fixes CID 1407219.

Fixes: f045a0104c8c ("vfio: unplug failover primary device before
  migration")
Signed-off-by: Jens Freimann <jfreimann@redhat.com>
---
 hw/vfio/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index e6569a7968..ed01774673 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2737,7 +2737,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
         error_setg(&vdev->migration_blocker,
                 "VFIO device doesn't support migration");
         ret = migrate_add_blocker(vdev->migration_blocker, &err);
-        if (err) {
+        if (ret) {
             error_propagate(errp, err);
             error_free(vdev->migration_blocker);
             return;
-- 
2.21.0



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

* Re: [PATCH] vfio: don't ignore return value of migrate_add_blocker
  2019-11-14 13:34 [PATCH] vfio: don't ignore return value of migrate_add_blocker Jens Freimann
@ 2019-11-14 13:39 ` Philippe Mathieu-Daudé
  2019-11-15  8:59 ` Stefano Garzarella
  2019-11-19 23:19 ` Alex Williamson
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-11-14 13:39 UTC (permalink / raw)
  To: Jens Freimann, qemu-devel; +Cc: alex.williamson

On 11/14/19 2:34 PM, Jens Freimann wrote:
> When an error occurs in migrate_add_blocker() it sets a
> negative return value and uses error pointer we pass in.
> Instead of just looking at the error pointer check for a negative return
> value and avoid a coverity error because the return value is
> set but never used. This fixes CID 1407219.
> 
> Fixes: f045a0104c8c ("vfio: unplug failover primary device before
>    migration")
> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
> ---
>   hw/vfio/pci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index e6569a7968..ed01774673 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2737,7 +2737,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
>           error_setg(&vdev->migration_blocker,
>                   "VFIO device doesn't support migration");
>           ret = migrate_add_blocker(vdev->migration_blocker, &err);
> -        if (err) {
> +        if (ret) {
>               error_propagate(errp, err);
>               error_free(vdev->migration_blocker);
>               return;
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



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

* Re: [PATCH] vfio: don't ignore return value of migrate_add_blocker
  2019-11-14 13:34 [PATCH] vfio: don't ignore return value of migrate_add_blocker Jens Freimann
  2019-11-14 13:39 ` Philippe Mathieu-Daudé
@ 2019-11-15  8:59 ` Stefano Garzarella
  2019-11-19 23:19 ` Alex Williamson
  2 siblings, 0 replies; 4+ messages in thread
From: Stefano Garzarella @ 2019-11-15  8:59 UTC (permalink / raw)
  To: Jens Freimann; +Cc: alex.williamson, qemu-devel

On Thu, Nov 14, 2019 at 02:34:49PM +0100, Jens Freimann wrote:
> When an error occurs in migrate_add_blocker() it sets a
> negative return value and uses error pointer we pass in.
> Instead of just looking at the error pointer check for a negative return
> value and avoid a coverity error because the return value is
> set but never used. This fixes CID 1407219.
> 
> Fixes: f045a0104c8c ("vfio: unplug failover primary device before
>   migration")
> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
> ---
>  hw/vfio/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>



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

* Re: [PATCH] vfio: don't ignore return value of migrate_add_blocker
  2019-11-14 13:34 [PATCH] vfio: don't ignore return value of migrate_add_blocker Jens Freimann
  2019-11-14 13:39 ` Philippe Mathieu-Daudé
  2019-11-15  8:59 ` Stefano Garzarella
@ 2019-11-19 23:19 ` Alex Williamson
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Williamson @ 2019-11-19 23:19 UTC (permalink / raw)
  To: Jens Freimann; +Cc: qemu-devel

On Thu, 14 Nov 2019 14:34:49 +0100
Jens Freimann <jfreimann@redhat.com> wrote:

> When an error occurs in migrate_add_blocker() it sets a
> negative return value and uses error pointer we pass in.
> Instead of just looking at the error pointer check for a negative return
> value and avoid a coverity error because the return value is
> set but never used. This fixes CID 1407219.
> 
> Fixes: f045a0104c8c ("vfio: unplug failover primary device before
>   migration")
> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
> ---
>  hw/vfio/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index e6569a7968..ed01774673 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2737,7 +2737,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
>          error_setg(&vdev->migration_blocker,
>                  "VFIO device doesn't support migration");
>          ret = migrate_add_blocker(vdev->migration_blocker, &err);
> -        if (err) {
> +        if (ret) {
>              error_propagate(errp, err);
>              error_free(vdev->migration_blocker);
>              return;

Slightly late notice, but I did include this in my last pull request
and it's included in v4.2.0-rc2 with Stefano and Philippe's R-b.
Thanks,

Alex



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

end of thread, other threads:[~2019-11-19 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 13:34 [PATCH] vfio: don't ignore return value of migrate_add_blocker Jens Freimann
2019-11-14 13:39 ` Philippe Mathieu-Daudé
2019-11-15  8:59 ` Stefano Garzarella
2019-11-19 23:19 ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).