qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Bugfix: Handle error if VM Generation ID device


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH] Bugfix: Handle error if VM Generation ID device not present
Date: Thu, 2 Mar 2017 23:41:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1

On 03/02/17 22:36, address@hidden wrote:
> From: Ben Warren <address@hidden>
> 
> This was crashing due to NULL-pointer dereference
> 
> QMP Test case:
> ==============
> 
> (QEMU) query-vm-generation-id
> {"error": {"class": "GenericError", "desc": "VM Generation ID device not
> found"}}
> 
> HMP Test case:
> ==============
> virsh # qemu-monitor-command --hmp 3 info vm-generation-id
> VM Generation ID device not found
> 
> Signed-off-by: Ben Warren <address@hidden>
> ---
>  hmp.c             | 4 +++-
>  hw/acpi/vmgenid.c | 1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hmp.c b/hmp.c
> index 261843f..edb8970 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -2608,9 +2608,11 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict 
> *qdict)
>  
>  void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict)
>  {
> -    GuidInfo *info = qmp_query_vm_generation_id(NULL);
> +    Error *err = NULL;
> +    GuidInfo *info = qmp_query_vm_generation_id(&err);
>      if (info) {
>          monitor_printf(mon, "%s\n", info->guid);
>      }
> +    hmp_handle_error(mon, &err);
>      qapi_free_GuidInfo(info);
>  }
> diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c
> index 744f284..7a3ad17 100644
> --- a/hw/acpi/vmgenid.c
> +++ b/hw/acpi/vmgenid.c
> @@ -248,6 +248,7 @@ GuidInfo *qmp_query_vm_generation_id(Error **errp)
>      Object *obj = find_vmgenid_dev();
>  
>      if (!obj) {
> +        error_setg(errp, "VM Generation ID device not found");
>          return NULL;
>      }
>      vms = VMGENID(obj);
> 

Reviewed-by: Laszlo Ersek <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]