Re: [PATCH v2 2/4] util: Change return type of virSCSIDeviceSetUsedBy to void

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

 



On Thu, Nov 28, 2024 at 16:28:08 +0300, Alexander Kuznetsov wrote:
> This function return value is invariant since 18f3771, so change
> its type and remove all dependent checks.
> 
> Found by Linux Verification Center (linuxtesting.org) with Svace.
> 
> Reported-by: Pavel Nekrasov <p.nekrasov@xxxxxxxxxxx>
> Signed-off-by: Alexander Kuznetsov <kuznetsovam@xxxxxxxxxxxx>
> ---
>  src/hypervisor/virhostdev.c | 12 ++++--------
>  src/util/virscsi.c          |  4 +---
>  src/util/virscsi.h          |  2 +-
>  tests/virscsitest.c         |  6 ++----
>  4 files changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
> index f8b5ab86e1..30a51507da 100644
> --- a/src/hypervisor/virhostdev.c
> +++ b/src/hypervisor/virhostdev.c
> @@ -1212,11 +1212,9 @@ virHostdevUpdateActiveSCSIHostDevices(virHostdevManager *mgr,
>          return -1;
>  
>      if ((tmp = virSCSIDeviceListFind(mgr->activeSCSIHostdevs, scsi))) {
> -        if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0)
> -            return -1;
> +        virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name);
>      } else {
> -        if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0 ||
> -            virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0)
> +        if (virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0)

Originally both SetUsedBy and ListAdd were called, but only ListAdd is
called now. The call to virSCSIDeviceSetUsedBy is missing.

>              return -1;
>          scsi = NULL;
>      }

The rest looks good.

Jirka



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux