From: Kevin Wolf <kwolf@redhat.com>
To: liguang <lig.fnst@cn.fujitsu.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH v4] correct error message qemu-img reported
Date: Thu, 06 Dec 2012 11:04:08 +0100 [thread overview]
Message-ID: <50C06D98.9040804@redhat.com> (raw)
In-Reply-To: <1352101300-12060-1-git-send-email-lig.fnst@cn.fujitsu.com>
Am 05.11.2012 08:41, schrieb liguang:
> 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 | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index b41e670..d9434ad 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -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
> + 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.");
>
WARNING: multiple messages have this Message-ID (diff)
From: Kevin Wolf <kwolf@redhat.com>
To: liguang <lig.fnst@cn.fujitsu.com>
Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi <stefanha@gmail.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4] correct error message qemu-img reported
Date: Thu, 06 Dec 2012 11:04:08 +0100 [thread overview]
Message-ID: <50C06D98.9040804@redhat.com> (raw)
In-Reply-To: <1352101300-12060-1-git-send-email-lig.fnst@cn.fujitsu.com>
Am 05.11.2012 08:41, schrieb liguang:
> 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 | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index b41e670..d9434ad 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -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
> + 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.");
>
next prev parent reply other threads:[~2012-12-06 10:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 7:41 [Qemu-trivial] [Qemu-devel][PATCH v4] correct error message qemu-img reported liguang
2012-11-05 7:41 ` [Qemu-devel] [PATCH " liguang
2012-11-05 10:27 ` [Qemu-trivial] [Qemu-devel][PATCH " Stefan Hajnoczi
2012-11-05 10:27 ` [Qemu-devel] [Qemu-trivial] [PATCH " Stefan Hajnoczi
2012-12-06 8:47 ` [Qemu-trivial] [Qemu-devel][PATCH " li guang
2012-12-06 8:47 ` [Qemu-devel] [Qemu-trivial] [PATCH " li guang
2012-12-06 10:04 ` Kevin Wolf [this message]
2012-12-06 10:04 ` [Qemu-devel] " Kevin Wolf
2012-12-07 3:56 ` [Qemu-trivial] " li guang
2012-12-07 3:56 ` li guang
2013-01-03 0:19 ` [Qemu-trivial] " Anthony Liguori
2013-01-03 0:19 ` [Qemu-devel] " Anthony Liguori
2013-01-03 1:08 ` [Qemu-trivial] " Peter Maydell
2013-01-03 1:08 ` Peter Maydell
2013-01-03 2:15 ` [Qemu-trivial] " Anthony Liguori
2013-01-03 2:15 ` Anthony Liguori
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=50C06D98.9040804@redhat.com \
--to=kwolf@redhat.com \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.