From: Gonglei <arei.gonglei@huawei.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: kwolf@redhat.com, lersek@redhat.com,
"Richard W.M. Jones" <rjones@redhat.com>,
stefanha@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block/curl: Improve type safety of s->timeout.
Date: Wed, 29 Oct 2014 10:08:07 +0800 [thread overview]
Message-ID: <54504C07.4080707@huawei.com> (raw)
In-Reply-To: <20141028142920.GD22805@stefanha-thinkpad.redhat.com>
On 2014/10/28 22:29, Stefan Hajnoczi wrote:
> On Mon, Oct 06, 2014 at 03:32:10PM +0100, Richard W.M. Jones wrote:
>> qemu_opt_get_number returns a uint64_t, and curl_easy_setopt expects a
>> long (not an int).
>>
>> Store the timeout (which is a positive number of seconds) as a
>> uint64_t. Check that the number given by the user is reasonable.
>> Cast it to long before calling curl_easy_setopt.
>>
>> Example error message after this change has been applied:
>>
>> $ ./qemu-img create -f qcow2 /tmp/test.qcow2 \
>> -b 'json: { "file.driver":"https",
>> "file.url":"https://foo/bar",
>> "file.timeout":-1 }'
>> qemu-img: /tmp/test.qcow2: Could not open 'json: { "file.driver":"https", "file.url":"https://foo/bar", "file.timeout":-1 }': timeout parameter is too large or negative: Invalid argument
>>
>> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
>> ---
>> block/curl.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> Thanks, applied to my block tree:
> https://github.com/stefanha/qemu/commits/block
>
> Stefan
Please don't, the patch had been posted v2 which is better:
[PATCH v2] block/curl: Improve type safety of s->timeout.
http://lists.gnu.org/archive/html/qemu-devel/2014-10/msg03112.html
Best regards,
-Gonglei
next prev parent reply other threads:[~2014-10-29 2:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-06 14:32 [Qemu-devel] [PATCH] block/curl: Improve type safety of s->timeout Richard W.M. Jones
2014-10-06 14:38 ` Laszlo Ersek
2014-10-06 14:40 ` Richard W.M. Jones
2014-10-06 14:43 ` Laszlo Ersek
2014-10-28 14:29 ` Stefan Hajnoczi
2014-10-29 2:08 ` Gonglei [this message]
2014-10-29 9:52 ` Stefan Hajnoczi
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=54504C07.4080707@huawei.com \
--to=arei.gonglei@huawei.com \
--cc=kwolf@redhat.com \
--cc=lersek@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=stefanha@gmail.com \
--cc=stefanha@redhat.com \
/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).