From: Alberto Garcia Date: Fri, 17 Apr 2015 12:44:48 +0000 (+0300) Subject: hmp: fix crash in 'info block -n -v' X-Git-Tag: qemu-xen-4.7.0-rc1~344 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=638b8366200130cc7cf7a026630bc6bfb63b0c4c;p=qemu-xen.git hmp: fix crash in 'info block -n -v' The image field in BlockDeviceInfo should never be null, however bdrv_block_device_info() is not filling it in. This makes the 'info block -n -v' command crash QEMU. The proper solution is probably to move the relevant code from bdrv_query_info() to bdrv_block_device_info(), but since we're too close to the release for that this simpler workaround solves the crash. Signed-off-by: Alberto Garcia Message-id: 1429274688-8115-1-git-send-email-berto@igalia.com Signed-off-by: Peter Maydell --- diff --git a/hmp.c b/hmp.c index f31ae2796a..f142d366ef 100644 --- a/hmp.c +++ b/hmp.c @@ -391,7 +391,8 @@ static void print_block_info(Monitor *mon, BlockInfo *info, inserted->iops_size); } - if (verbose) { + /* TODO: inserted->image should never be null */ + if (verbose && inserted->image) { monitor_printf(mon, "\nImages:\n"); image_info = inserted->image; while (1) {