Re: [PATCH 3/3] conf: Fix error path in virNodeDevPCICapabilityParseXML

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

 



On 06/05/16 21:35, John Ferlan wrote:
> If the call to virXPathNodeSet to set naddresses fails, Coverity notes
> that the subsequent VIR_ALLOC_N cannot have a negative value (well it
> probably wouldn't be negative per se).
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/conf/node_device_conf.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
> index a06e450..aed95d5 100644
> --- a/src/conf/node_device_conf.c
> +++ b/src/conf/node_device_conf.c
> @@ -1305,7 +1305,10 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt,
>                                          data->pci_dev.physical_function) < 0)
>              goto out;
>      } else if (STREQ(type, "virt_functions")) {
> -        int naddresses = virXPathNodeSet("./address", ctxt, &addresses);
> +        int naddresses;
> +
> +        if ((naddresses = virXPathNodeSet("./address", ctxt, &addresses)) < 0)
> +            goto out;
>  
>          if (maxFuncsStr &&
>              virStrToLong_uip(maxFuncsStr, NULL, 10,
> 

ACK

Erik

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