Skip to contentSkip to conversation

qcow2: fix the macro QCOW_MAX_L1_SIZE's use

PATCH Applied Wen Congyang 2 participants 2 messages Mar 11, 2015 – Mar 12, 2015 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qcow2: fix the macro QCOW_MAX_L1_SIZE's use

QCOW_MAX_L1_SIZE's unit is byte, and l1_size's unit is l1 table entry size(8 bytes).

---
 block/qcow2-snapshot.c | 2 +-
 block/qcow2.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
block/qcow2-snapshot.c +1 -1
index 5b3903c..2aa9dcb 100644
@@ -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;
     }
block/qcow2.c +1 -1
index 8bfb094..32bdf75 100644
@@ -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;
Signature · 1 line
2.1.0