[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/2] blockdev: Error out on nega
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/2] blockdev: Error out on negative throttling option values |
Date: |
Wed, 13 Jan 2016 20:21:47 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 01/13/2016 03:17 AM, Alberto Garcia wrote:
> On Wed 13 Jan 2016 01:52:29 AM CET, Fam Zheng wrote:
>
>> The implicit casting from unsigned int to double changes negative values
>> into large positive numbers and accepts them. We should instead print
>> an error.
>>
>> Check the number range so this case is catched and reported.
s/catched/caught/
>
> I still don't know why qemu_opt_get_number() convert silently negative
> numbers into positive ones, shouldn't it just fail with an "invalid
> parameter" error?
Passing -1 as a synonym for ULLONG_MAX can be convenient. But rejecting
it outright rather than doing wraparound wouldn't hurt libvirt too badly.
>
>> +#define THROTTLE_VALUE_MAX 1000000000000000L
>
> This is larger than LONG_MAX in 32-bit systems, I don't know if you need
> to use LL instead.
You do need LL, not for C99, but for older compilers (hello mingw).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-block] [PATCH v2 2/2] iotests: Test that negative throttle values are rejected, Fam Zheng, 2016/01/12