[libvirt] [PATCH] qemu: Avoid crashes in qemuDomainMachineIs*()

Andrea Bolognani abologna at redhat.com
Tue Oct 10 15:05:33 UTC 2017


On Tue, 2017-10-10 at 15:49 +0100, Daniel P. Berrange wrote:
> I think rather than trying to fix up the assumption about
> machine being non-NULL, we should restructure the ARGV
> parsing into we need a 2 pass process.
> 
> In the first pass only look for the -machine arg. If no
> -machine arg is given, we should fill in the default machine
> for that emulator.

I can do this...

> In the second pass process the rest of the ARGV, whereupon
> we have a valid assumption that machine is non-NULL.

... but I'm not sure doing this is a good idea.

Wouldn't it be much safer to leave the newly-added NULL checks
in place so that the qemuDomainMachineIs*() functions are locally
correct instead of relying on external guarantees in order not
to crash on the user?

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list