Re: [PATCH v2 4/4] virDomainFormatSchedDef: Avoid false positive NULL dereference

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

 



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 <mprivozn@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)

ACK

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