[libvirt] [PATCH 6/6] conf: Fix build with picky GCC

Jiri Denemark jdenemar at redhat.com
Fri Aug 26 02:26:35 UTC 2016


On Thu, Aug 25, 2016 at 18:42:50 -0400, Peter Krempa wrote:
> ../../src/conf/domain_conf.c:4425:21: error: potential null pointer dereference [-Werror=null-dereference]
>          switch (vcpu->hotpluggable) {
>                  ~~~~^~~~~~~~~~~~~~
> ---
>  src/conf/domain_conf.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index ae3eb14..61f6dbb 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -4422,6 +4422,10 @@ virDomainVcpuDefPostParse(virDomainDefPtr def)
>      for (i = 0; i < maxvcpus; i++) {
>          vcpu = virDomainDefGetVcpu(def, i);
> 
> +        /* impossible but some compilers don't like it */
> +        if (!vcpu)
> +            continue;
> +
>          switch (vcpu->hotpluggable) {
>          case VIR_TRISTATE_BOOL_ABSENT:
>              if (vcpu->online)

ACK

Jirka




More information about the libvir-list mailing list