From: liguang <lig.fnst@cn.fujitsu.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, liguang <lig.fnst@cn.fujitsu.com>
Subject: [Qemu-devel] [PATCH v3] correct error message qemu-img reported
Date: Fri, 2 Nov 2012 13:11:22 +0800 [thread overview]
Message-ID: <1351833082-26633-1-git-send-email-lig.fnst@cn.fujitsu.com> (raw)
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 | 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
next reply other threads:[~2012-11-02 5:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-02 5:11 liguang [this message]
2012-11-02 7:16 ` [Qemu-devel] [PATCH v3] correct error message qemu-img reported Stefan Hajnoczi
2012-11-05 7:40 ` li guang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351833082-26633-1-git-send-email-lig.fnst@cn.fujitsu.com \
--to=lig.fnst@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).