From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW8VX-0003ay-Ew for qemu-devel@nongnu.org; Thu, 12 Mar 2015 15:11:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YW8VT-0007AZ-CZ for qemu-devel@nongnu.org; Thu, 12 Mar 2015 15:10:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW8VT-0007AP-5f for qemu-devel@nongnu.org; Thu, 12 Mar 2015 15:10:55 -0400 From: Stefan Hajnoczi Date: Thu, 12 Mar 2015 19:10:33 +0000 Message-Id: <1426187433-29136-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1426187433-29136-1-git-send-email-stefanha@redhat.com> References: <1426187433-29136-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 2/2] qcow2: fix the macro QCOW_MAX_L1_SIZE's use List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefan Hajnoczi From: Wen Congyang QCOW_MAX_L1_SIZE's unit is byte, and l1_size's unit is l1 table entry size(8 bytes). Signed-off-by: Wen Congyang Message-id: 54FFB0F1.5010307@cn.fujitsu.com Signed-off-by: Stefan Hajnoczi --- block/qcow2-snapshot.c | 2 +- block/qcow2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 5b3903c..2aa9dcb 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -702,7 +702,7 @@ int qcow2_snapshot_load_tmp(BlockDriverState *bs, sn = &s->snapshots[snapshot_index]; /* Allocate and read in the snapshot's L1 table */ - if (sn->l1_size > QCOW_MAX_L1_SIZE) { + if (sn->l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { error_setg(errp, "Snapshot L1 table too large"); return -EFBIG; } diff --git a/block/qcow2.c b/block/qcow2.c index 8bfb094..32bdf75 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -742,7 +742,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, } /* read the level 1 table */ - if (header.l1_size > QCOW_MAX_L1_SIZE) { + if (header.l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { error_setg(errp, "Active L1 table too large"); ret = -EFBIG; goto fail; -- 2.1.0