[libvirt] [PATCH 02/13] conf: remove redundant iothreads variable

Peter Krempa pkrempa at redhat.com
Mon Feb 20 09:30:41 UTC 2017


On Fri, Feb 17, 2017 at 15:49:06 +0100, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  src/conf/domain_conf.c  | 32 +++++++++++++++++---------------
>  src/conf/domain_conf.h  |  1 -
>  src/qemu/qemu_driver.c  |  6 ------
>  src/qemu/qemu_process.c |  1 -
>  4 files changed, 17 insertions(+), 23 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index a179c1e278..71cd572a30 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c

[...]

> @@ -16755,8 +16756,9 @@ virDomainDefParseXML(xmlDocPtr xml,
>          goto error;
>  
>      /* Optional - iothreads */
> +    unsigned int iothreads;

This will be used uninitialized ...

>      tmp = virXPathString("string(./iothreads[1])", ctxt);
> -    if (tmp && virStrToLong_uip(tmp, NULL, 10, &def->iothreads) < 0) {
> +    if (tmp && virStrToLong_uip(tmp, NULL, 10, &iothreads) < 0) {

if tmp is NULL

>          virReportError(VIR_ERR_XML_ERROR,
>                         _("invalid iothreads count '%s'"), tmp);
>          goto error;
> @@ -16767,8 +16769,8 @@ virDomainDefParseXML(xmlDocPtr xml,
>      if ((n = virXPathNodeSet("./iothreadids/iothread", ctxt, &nodes)) < 0)
>          goto error;
>  
> -    if (n > def->iothreads)
> -        def->iothreads = n;
> +    if (n > iothreads)

... here ...

> +        iothreads = n;
>  
>      if (n && VIR_ALLOC_N(def->iothreadids, n) < 0)

... and here.

>          goto error;

ACK with the above fixed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170220/112464f2/attachment-0001.sig>


More information about the libvir-list mailing list