Re: [PATCH] Make really sure we don't access non-existing vCPUs

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

 



On Tue, Jul 12, 2016 at 13:44:10 +0200, Martin Kletzander wrote:
> MinGW complained that we might be dereferencing a NULL pointer.  While

^^ Does anybody use that?

> that's most probably not going to be true (now), the logic certainly
> allows for that and we might actually do this a lot in the future with
> sparse vcpu mapping.
> 
> ../../src/conf/domain_conf.c: In function 'virDomainDefGetVcpuPinInfoHelper':
> ../../src/conf/domain_conf.c:1545:17: error: potential null pointer
> dereference [-Werror=null-dereference]
>          if (vcpu->cpumask)
>               ~~~~^~~~~~~~~
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
> I could've pushed this as a build breaker, but I'm not really sure
> everyone will like this to be handled this way.  I also did another
> fix for this where we don't do int->size_t->int casting all the time,
> but it's probably not worth the hassle.  Also I don't know whether
> Peter has more stuff for this in his pockets now, so I figured I
> rather submit this for review.

It's impossible since virDomainDefGetVcpu returns a valid pointer if i
is less than def->maxvcpus.

Since we are rather adding dead code than not supporting broken
toolchain ... ACK.

> 
>  src/conf/domain_conf.c | 3 +++
>  1 file changed, 3 insertions(+)

Peter

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