On Thu, Jun 02, 2016 at 12:42:53 +0200, Michal Privoznik wrote:
> Okay, I admit that our code here is complex. It's not easy to
> spot that NULL deref can't really happen here. So it's no wonder
> that a dumb compiler fails to see all the connections and
> produces the following errors:
> 
>   CC       conf/libvirt_conf_la-domain_conf.lo
> conf/domain_conf.c: In function 'virDomainDefFormatInternal':
> conf/domain_conf.c:22162:22: error: potential null pointer dereference 
> [-Werror=null-dereference]
>              if (sched->policy == i)
>                  ~~~~~^~~~~~~~
> conf/domain_conf.c:22191:26: error: potential null pointer dereference 
> [-Werror=null-dereference]
>                  priority = sched->priority;
>                  ~~~~~~~~~^~~~~~~~~~~~~~~~~
> conf/domain_conf.c:22197:30: error: potential null pointer dereference 
> [-Werror=null-dereference]
>                      if (sched->priority == priority)
>                          ~~~~~^~~~~~~~~~
> conf/domain_conf.c:22162:22: error: potential null pointer dereference 
> [-Werror=null-dereference]
>              if (sched->policy == i)
>                  ~~~~~^~~~~~~~
> conf/domain_conf.c:22191:26: error: potential null pointer dereference 
> [-Werror=null-dereference]
>                  priority = sched->priority;
>                  ~~~~~~~~~^~~~~~~~~~~~~~~~~
> conf/domain_conf.c:22197:30: error: potential null pointer dereference 
> [-Werror=null-dereference]
>                      if (sched->priority == priority)
>                          ~~~~~^~~~~~~~~~

I think you can trime a few of those.

> cc1: all warnings being treated as errors
> 
> Signed-off-by: Michal Privoznik <[email protected]>
> ---
>  src/conf/domain_conf.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)

ACK

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to