]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qcow2: fix the macro QCOW_MAX_L1_SIZE's use
authorWen Congyang <wency@cn.fujitsu.com>
Wed, 11 Mar 2015 03:05:21 +0000 (11:05 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 12 Mar 2015 17:41:23 +0000 (17:41 +0000)
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 <wency@cn.fujitsu.com>
Message-id: 54FFB0F1.5010307@cn.fujitsu.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/qcow2-snapshot.c
block/qcow2.c

index 5b3903cf2252f93236b239a26d330d1a8557a7ae..2aa9dcb1d13f84263575a021a936d6d2b55ed3a7 100644 (file)
@@ -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;
     }
index 8bfb094e53aca1a9805ddb072b58802f3479766b..32bdf756cabc33a55a249a9065cffdbbcf200597 100644 (file)
@@ -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;