diff mbox

qmp: fill in the image field in BlockDeviceInfo

Message ID w51oamn0x5n.fsf@maestria.local.igalia.com
State New
Headers show

Commit Message

Alberto Garcia April 17, 2015, 12:14 p.m. UTC
On Fri 17 Apr 2015 01:52:43 PM CEST, Alberto Garcia <berto@igalia.com> wrote:

> Anyone calling bdrv_block_device_info() directly will get a null image
> field. As a consequence of this, the HMP command 'info block -n -v'
> crashes QEMU.
>
> This patch moves the code that fills in that field from
> bdrv_query_info() to bdrv_block_device_info().

And in case this change is too big/risky for 2.3, there's also the
simple workaround for the crash:


Berto
diff mbox

Patch

--- a/hmp.c
+++ b/hmp.c
@@ -391,7 +391,7 @@  static void print_block_info(Monitor *mon, BlockInfo *info,
                         inserted->iops_size);
     }
 
-    if (verbose) {
+    if (verbose && inserted->image) {
         monitor_printf(mon, "\nImages:\n");
         image_info = inserted->image;
         while (1) {