diff mbox

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

Message ID 1354852190-15095-2-git-send-email-lig.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

liguang Dec. 7, 2012, 3:49 a.m. UTC
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(-)

Comments

Markus Armbruster Dec. 11, 2012, 3:11 p.m. UTC | #1
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. UTC | #2
在 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!
diff mbox

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