Re: [PATCH 1/1] Fix issue found by coverity and cleanup

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

 



On Mon, Mar 17, 2014 at 03:22:11PM +0100, Pavel Hrdina wrote:
> Coverity found an issue in lxc_driver and uml_driver that we don't
> check the return value of register functions.
> 
> I've also updated all other places and unify the way we check the
> return value.
> 
> Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 955465a..c9711bb 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -7825,15 +7825,23 @@ remoteRegister(void)
>  {
>      remoteDriver = &remote_driver;
>  
> -    if (virRegisterDriver(&remote_driver) == -1) return -1;
> -    if (virRegisterNetworkDriver(&network_driver) == -1) return -1;
> -    if (virRegisterInterfaceDriver(&interface_driver) == -1) return -1;
> -    if (virRegisterStorageDriver(&storage_driver) == -1) return -1;
> -    if (virRegisterNodeDeviceDriver(&node_device_driver) == -1) return -1;
> -    if (virRegisterSecretDriver(&secret_driver) == -1) return -1;
> -    if (virRegisterNWFilterDriver(&nwfilter_driver) == -1) return -1;
> +    if (virRegisterDriver(&remote_driver) < 0)
> +        return -1;
> +    if (virRegisterNetworkDriver(&network_driver) < 0)
> +        return -1;
> +    if (virRegisterInterfaceDriver(&interface_driver) < 0)
> +        return -1;
> +    if (virRegisterStorageDriver(&storage_driver) < 0)
> +        return -1;
> +    if (virRegisterNodeDeviceDriver(&node_device_driver) < 0)
> +        return -1;
> +    if (virRegisterSecretDriver(&secret_driver) < 0)
> +        return -1;
> +    if (virRegisterNWFilterDriver(&nwfilter_driver) < 0)
> +        return -1;
>  #ifdef WITH_LIBVIRTD
> -    if (virRegisterStateDriver(&state_driver) == -1) return -1;
> +    if (virRegisterStateDriver(&state_driver) == -1) < 0)
> +        return -1;
>  #endif

Opps, I missed that you left in the  '== -1)' bit here

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
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]