All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qcow2: fix the macro QCOW_MAX_L1_SIZE's use
@ 2015-03-11  3:05 Wen Congyang
  2015-03-12 13:54 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Wen Congyang @ 2015-03-11  3:05 UTC (permalink / raw)
  To: qemu-devl, Max Reitz; +Cc: Kevin Wolf

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>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] qcow2: fix the macro QCOW_MAX_L1_SIZE's use
  2015-03-11  3:05 [Qemu-devel] [PATCH] qcow2: fix the macro QCOW_MAX_L1_SIZE's use Wen Congyang
@ 2015-03-12 13:54 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2015-03-12 13:54 UTC (permalink / raw)
  To: Wen Congyang; +Cc: Kevin Wolf, qemu-devl, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

On Wed, Mar 11, 2015 at 11:05:21AM +0800, Wen Congyang wrote:
> 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>
> ---
>  block/qcow2-snapshot.c | 2 +-
>  block/qcow2.c          | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-12 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-11  3:05 [Qemu-devel] [PATCH] qcow2: fix the macro QCOW_MAX_L1_SIZE's use Wen Congyang
2015-03-12 13:54 ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.