[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3] correct error message qemu-img reported
From: |
liguang |
Subject: |
[Qemu-devel] [PATCH v3] correct error message qemu-img reported |
Date: |
Fri, 2 Nov 2012 13:11:22 +0800 |
qemu-img will complain when qcow or qcow2
size overflow for 64 bits, report the right
message in this condition.
Signed-off-by: liguang <address@hidden>
---
qemu-img.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index b41e670..d4ea800 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -337,10 +337,15 @@ static int img_create(int argc, char **argv)
/* Get image size, if specified */
if (optind < argc) {
- int64_t sval;
+ int64_t sval = 0;
char *end;
sval = strtosz_suffix(argv[optind++], &end, STRTOSZ_DEFSUFFIX_B);
- if (sval < 0 || *end) {
+ if (sval < 0) {
+ error_report("image size is too large!");
+ ret = -1;
+ goto out;
+ }
+ if (*end) {
error_report("Invalid image size specified! You may use k, M, G or
"
"T suffixes for ");
error_report("kilobytes, megabytes, gigabytes and terabytes.");
--
1.7.1
- [Qemu-devel] [PATCH v3] correct error message qemu-img reported,
liguang <=