Patchwork [[PATCH,2/2] qemu-img:report size overflow error message

login
register
mail settings
Submitter liguang
Date Dec. 7, 2012, 3:49 a.m.
Message ID <1354852190-15095-2-git-send-email-lig.fnst@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/204384/
State New
Headers show

Comments

liguang - Dec. 7, 2012, 3:49 a.m.
qemu-img will complain when qcow or qcow2
size overflow for 64 bits, report the right
message in this condition.

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 qemu-img.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Markus Armbruster - Dec. 11, 2012, 3:11 p.m.
liguang <lig.fnst@cn.fujitsu.com> writes:

> qemu-img will complain when qcow or qcow2
> size overflow for 64 bits, report the right
> message in this condition.

Recommend to show the reproducer with output before and after the patch
in the commit message.
liguang - Dec. 12, 2012, 12:59 a.m.
在 2012-12-11二的 16:11 +0100,Markus Armbruster写道:
> liguang <lig.fnst@cn.fujitsu.com> writes:
> 
> > qemu-img will complain when qcow or qcow2
> > size overflow for 64 bits, report the right
> > message in this condition.
> 
> Recommend to show the reproducer with output before and after the patch
> in the commit message.

OK, reasonable.
Thanks!

Patch

diff --git a/qemu-img.c b/qemu-img.c
index e29e01b..f3209b4 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -353,6 +353,11 @@  static int img_create(int argc, char **argv)
             ret = -1;
             goto out;
         }
+        if (sval == 0) {
+            error_report("Image size must be less than 8 exabytes!");
+            ret = -1;
+            goto out;
+        }
         img_size = (uint64_t)sval;
     }