Re: [Qemu-block] [PATCH v2 1/2] blockdev: Error out on negative throttling option values

2016-01-13 Thread Alberto Garcia
On Wed 13 Jan 2016 12:02:00 PM CET, Fam Zheng wrote: >> > Check the number range so this case is catched and reported. >> >> 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? > >

Re: [Qemu-block] [PATCH v2 1/2] blockdev: Error out on negative throttling option values

2016-01-13 Thread Fam Zheng
On Wed, 01/13 11:17, 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

Re: [Qemu-block] [PATCH v2 1/2] blockdev: Error out on negative throttling option values

2016-01-13 Thread Fam Zheng
On Wed, 01/13 12:13, Alberto Garcia wrote: > On Wed 13 Jan 2016 12:02:00 PM CET, Fam Zheng wrote: > > >> > Check the number range so this case is catched and reported. > >> > >> I still don't know why qemu_opt_get_number() convert silently > >> negative numbers into positive ones, shouldn't it

[Qemu-block] [PATCH v2 1/2] blockdev: Error out on negative throttling option values

2016-01-12 Thread Fam Zheng
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. Signed-off-by: Fam Zheng --- blockdev.c | 3 ++-