[libvirt] [PATCH 3/7] util: Resolve Coverity FORWARD_NULL

Peter Krempa pkrempa at redhat.com
Wed Jul 1 15:11:04 UTC 2015


On Wed, Jul 01, 2015 at 10:03:47 -0400, John Ferlan wrote:
> Convert virPCIDriverDir to return the buffer allocated (or not) and make the
> appropriate check in the caller.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/util/virpci.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/src/util/virpci.c b/src/util/virpci.c
> index 5d86c89..5dabb61 100644
> --- a/src/util/virpci.c
> +++ b/src/util/virpci.c

...

> @@ -998,7 +997,7 @@ virPCIProbeStubDriver(const char *driver)
>      bool probed = false;
>  
>   recheck:
> -    if (virPCIDriverDir(&drvpath, driver) == 0 && virFileExists(drvpath)) {
> +    if ((drvpath = virPCIDriverDir(driver))  && virFileExists(drvpath)) {

Extra space before &&.

>          /* driver already loaded, return */
>          VIR_FREE(drvpath);
>  return 0;

ACK with above comment fixed.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150701/93349f7d/attachment-0001.sig>


More information about the libvir-list mailing list