Re: [PATCH] hostdev: Fix build with GCC's static analysis in mdev

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

 




On 03/27/2017 11:30 AM, Martin Kletzander wrote:
> Similarly to eec3b255d26e7b38bdb0830990569fd91aee661f, fix build with
> lv_cv_static_analysis=yes.
> 
> Caused by a4a39d90ab4930750bcbcfccffdf6bb6d310b5d5
> ---
>  src/util/virhostdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Sure that's another way to fix it... Could have also gone with the
removal of NONNULL in the prototype like I did.  IDC whichever way is
deemed "more appropriate"...

Seeing as drv_name is only ever passed as QEMU_DRIVER_NAME, but dom_name
is passed from 'name' which doesn't have the NONNULL on it, that's why I
chose removing NONNULL from the prototype.

John

> diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
> index 2c557f5bbc6b..998df5871539 100644
> --- a/src/util/virhostdev.c
> +++ b/src/util/virhostdev.c
> @@ -2060,8 +2060,8 @@ virHostdevReAttachMediatedDevices(virHostdevManagerPtr mgr,
>              continue;
> 
>          virMediatedDeviceGetUsedBy(tmp, &used_by_drvname, &used_by_domname);
> -        if (STREQ_NULLABLE(drv_name, used_by_drvname) &&
> -            STREQ_NULLABLE(dom_name, used_by_domname)) {
> +        if (used_by_drvname && STREQ(drv_name, used_by_drvname) &&
> +            used_by_domname && STREQ(dom_name, used_by_domname)) {
>              VIR_DEBUG("Removing %s dom=%s from activeMediatedHostdevs",
>                        mdevsrc->uuidstr, dom_name);
>              virMediatedDeviceListDel(mgr->activeMediatedHostdevs, tmp);
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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