Skip to contentSkip to conversation

correct error message qemu-img reported

PATCH NAK liguang 5 participants 8 messages Nov 5, 2012 – Jan 3, 2013

lore
Share & tools
lore

liguang

author
#0 lore raw

PATCH v4 1/1 correct error message qemu-img reported

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

---
 qemu-img.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
qemu-img.c +6 -1
index b41e670..d9434ad 100644
@@ -340,7 +340,12 @@ static int img_create(int argc, char **argv)
         int64_t sval;
         char *end;
         sval = strtosz_suffix(argv[optind++], &end, STRTOSZ_DEFSUFFIX_B);
-        if (sval < 0 || *end) {
+        if (sval < 0) {
+            error_report("Image size must be less than 8 exabytes!");
+            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.");
Signature · 1 line
1.7.1
author
#2 lore raw

Hi, Stefan

seems this tiny patch was ignored.

Quoted 11 lines · 在 2012-11-05一的 11:27 +0100,Stefan Hajnoczi写道:
Quoted 8 lines · liguang

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

---
 qemu-img.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
Signature · 2 lines
regards!
li guang
#3 lore raw
In reply to liguang

Am 05.11.2012 08:41, schrieb liguang:

Quoted 14 lines

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

---
 qemu-img.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
qemu-img.c +0 -0
index b41e670..d9434ad 100644

qemu-img.c static int img_create(int argc, char **argv) · line 347

Quoted 9 lines
qemu-img.c +5 -1
@@ -340,7 +340,12 @@ static int img_create(int argc, char **argv)
         int64_t sval;
         char *end;
         sval = strtosz_suffix(argv[optind++], &end, STRTOSZ_DEFSUFFIX_B);
-        if (sval < 0 || *end) {
+        if (sval < 0) {
+            error_report("Image size must be less than 8 exabytes!");
+            ret = -1;
+            goto out;
+        }

This is wrong, overflows are not the only way how strtosz_suffix() can fail.

Before this patch:

$ ./qemu-img create /tmp/foo bar
qemu-img: Invalid image size specified! You may use k, M, G or T
suffixes for
qemu-img: kilobytes, megabytes, gigabytes and terabytes

With the patch applied:

$ ./qemu-img create /tmp/foo bar
qemu-img: Image size must be less than 8 exabytes!

Kevin

Quoted 5 lines
qemu-img.c +1 -0
+        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.");
author
#4 lore raw
Quoted 34 lines · 在 2012-12-06四的 11:04 +0100,Kevin Wolf写道:

Am 05.11.2012 08:41, schrieb liguang:

Quoted 14 lines

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

---
 qemu-img.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
qemu-img.c +0 -0
index b41e670..d9434ad 100644

qemu-img.c static int img_create(int argc, char **argv) · line 347

Quoted 9 lines
qemu-img.c +5 -1
@@ -340,7 +340,12 @@ static int img_create(int argc, char **argv)
         int64_t sval;
         char *end;
         sval = strtosz_suffix(argv[optind++], &end, STRTOSZ_DEFSUFFIX_B);
-        if (sval < 0 || *end) {
+        if (sval < 0) {
+            error_report("Image size must be less than 8 exabytes!");
+            ret = -1;
+            goto out;
+        }

This is wrong, overflows are not the only way how strtosz_suffix() can fail.

Before this patch:

$ ./qemu-img create /tmp/foo bar
qemu-img: Invalid image size specified! You may use k, M, G or T
suffixes for
qemu-img: kilobytes, megabytes, gigabytes and terabytes
Quoted 5 lines

With the patch applied:

$ ./qemu-img create /tmp/foo bar
qemu-img: Image size must be less than 8 exabytes!

Oh, my fault, I'll fix.
Thanks!

Quoted 11 lines

Kevin

Quoted 5 lines
qemu-img.c +1 -0
+        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.");
Signature · 2 lines
regards!
li guang
Nacked-by on v4 1/1 NAK
#5 lore raw
In reply to liguang

Hi,

This is an automated message generated from the QEMU Patches. Thank you for submitting this patch. This patch no longer applies to qemu.git.

This may have occurred due to:

1) Changes in mainline requiring your patch to be rebased and re-tested.

2) Sending the mail using a tool other than git-send-email. Please use git-send-email to send patches to QEMU.

3) Basing this patch off of a branch that isn't tracking the QEMU master branch. If that was done purposefully, please include the name of the tree in the subject line in the future to prevent this message.

For instance: "[PATCH block-next 1/10] qcow3: add fancy new feature"

4) You no longer wish for this patch to be applied to QEMU. No additional action is required on your part.

Below is the output from git-am:

Applying: correct error message qemu-img reported
Using index info to reconstruct a base tree...
M qemu-img.c
Falling back to patching base and 3-way merge... Auto-merging qemu-img.c
CONFLICT (content): Merge conflict in qemu-img.c
Failed to merge in the changes.
Patch failed at 0001 correct error message qemu-img reported The copy of the patch that failed is found in:
/home/aliguori/patches/qemu.git/.git/rebase-apply/patch
When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".

#6 lore raw
Quoted 4 lines · Anthony Liguori

This is an automated message generated from the QEMU Patches. Thank you for submitting this patch. This patch no longer applies to qemu.git.

Are we going to get these emails on every old patch that was superseded by a later fixed version 2?

-- PMM

#7 lore raw
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Anthony Liguori

This is an automated message generated from the QEMU Patches. Thank you for submitting this patch. This patch no longer applies to qemu.git.

Are we going to get these emails on every old patch that was superseded by a later fixed version 2?

Nope.

Patches detects obsoleted patches and ignores them. It also detects patches that have been committed in submaintainer trees but have not yet made there way into qemu.git.

Regards,

Anthony Liguori

Quoted 2 lines

-- PMM