From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj5du-0003hE-OI for qemu-devel@nongnu.org; Fri, 17 Apr 2015 08:45:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yj5dp-0005O8-HE for qemu-devel@nongnu.org; Fri, 17 Apr 2015 08:45:10 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:47988 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj5dp-0005Kr-Ah for qemu-devel@nongnu.org; Fri, 17 Apr 2015 08:45:05 -0400 From: Alberto Garcia Date: Fri, 17 Apr 2015 15:44:48 +0300 Message-Id: <1429274688-8115-1-git-send-email-berto@igalia.com> Subject: [Qemu-devel] [PATCH for-2.3] hmp: fix crash in 'info block -n -v' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Maydell , Alberto Garcia 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 --- hmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hmp.c b/hmp.c index f31ae27..f142d36 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) { -- 2.1.4