On Fri, Mar 01, 2019 at 12:13:08PM +0800, 08005...@163.com wrote:
> From: Michael Qiu <qiud...@huayun.com>
> 
> When using command -device virtio-vga,virgl=on
> the default max_outputs is 0, this will lead coredump,

The default is 1.

> @@ -46,6 +46,11 @@ static void virtio_gpu_pci_realize(VirtIOPCIProxy 
> *vpci_dev, Error **errp)
>      int i;
>      Error *local_error = NULL;
>  
> +    if (g->conf.max_outputs <= 0) {
> +        qemu_log("WARNING: virtio gpu max_outputs must greater than 1");
> +        g->conf.max_outputs = 1;
> +    }

There already is a sanity check in virtio_gpu_device_realize().
You can extend that to also throw an error in case max_outputs
is 0.  Fixing things up and continuing is a bad idea.  Yes there
are places in the qemu code base still doing that, for backward
compatibility with old versions, but we should not add new
instances of this.

cheers,
  Gerd


Reply via email to