From c2551b47c9b9465962c4000268eda1307f55614a Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 1 Dec 2015 15:16:49 +0100 Subject: [PATCH 1/2] qcow2: Fix potential qemu-img check crash on 32 bit hosts This crash was caught with qemu-iotests test case 138. Commit b6d36de already fixed a few 32 bit truncation bugs that could cause qemu-img check to allocate too little memory and consequently it would segfault. On 32 bit hosts, there is one more place that needs to be fixed because size_t was involved in the calculation and is a 32 bit type there. Cc: qemu-stable@nongnu.org Reported-by: Michael S. Tsirkin Signed-off-by: Kevin Wolf Tested-by: Michael S. Tsirkin --- block/qcow2-refcount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 6e0e5bd9ae..820f412ab6 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -1244,7 +1244,7 @@ fail: /* refcount checking functions */ -static size_t refcount_array_byte_size(BDRVQcow2State *s, uint64_t entries) +static uint64_t refcount_array_byte_size(BDRVQcow2State *s, uint64_t entries) { /* This assertion holds because there is no way we can address more than * 2^(64 - 9) clusters at once (with cluster size 512 = 2^9, and because From 20873526a329e2145522c29775542dba2900ebe0 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Mon, 30 Nov 2015 13:44:44 +0200 Subject: [PATCH 2/2] blkdebug: silence warning under qtest make check always outputs warnings, this is not nice. Disable blkdebug warnings under qtest. Signed-off-by: Michael S. Tsirkin Message-id: 1448883874-17933-1-git-send-email-mst@redhat.com Signed-off-by: Max Reitz --- block/blkdebug.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index 6860a2ba2f..dee3a0edfc 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -30,6 +30,7 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qint.h" #include "qapi/qmp/qstring.h" +#include "sysemu/qtest.h" typedef struct BDRVBlkdebugState { int state; @@ -583,9 +584,13 @@ static void suspend_request(BlockDriverState *bs, BlkdebugRule *rule) remove_rule(rule); QLIST_INSERT_HEAD(&s->suspended_reqs, &r, next); - printf("blkdebug: Suspended request '%s'\n", r.tag); + if (!qtest_enabled()) { + printf("blkdebug: Suspended request '%s'\n", r.tag); + } qemu_coroutine_yield(); - printf("blkdebug: Resuming request '%s'\n", r.tag); + if (!qtest_enabled()) { + printf("blkdebug: Resuming request '%s'\n", r.tag); + } QLIST_REMOVE(&r, next); g_free(r.tag);