[Qemu-devel] [PATCH] monitor: fix parsing of big int

2013-08-01 Thread Fam Zheng
We call strtoull(3) to parse a string to int. the range we can accept with our local variable int64_t n is (-9223372036854775808 ~ 9223372036854775807), but strtoull(3) can return (0 ~ 18446744073709551615UL). So when we pass a int from HMP within the range of 9223372036854775808 ~

Re: [Qemu-devel] [PATCH] monitor: fix parsing of big int

2013-08-01 Thread Eric Blake
On 08/01/2013 12:31 AM, Fam Zheng wrote: Fix it by calling strtoll instead, which will report ERANGE as expected. (HMP) block_set_io_throttle ide0-hd0 99 0 0 0 0 0 (HMP) block_set_io_throttle ide0-hd0 999 0 0 0 0 0 number too large (HMP)

Re: [Qemu-devel] [PATCH] monitor: fix parsing of big int

2013-08-01 Thread Luiz Capitulino
On Thu, 01 Aug 2013 07:52:17 -0600 Eric Blake ebl...@redhat.com wrote: On 08/01/2013 12:31 AM, Fam Zheng wrote: Fix it by calling strtoll instead, which will report ERANGE as expected. (HMP) block_set_io_throttle ide0-hd0 99 0 0 0 0 0 (HMP) block_set_io_throttle

Re: [Qemu-devel] [PATCH] monitor: fix parsing of big int

2013-08-01 Thread Fam Zheng
On Thu, 08/01 07:52, Eric Blake wrote: On 08/01/2013 12:31 AM, Fam Zheng wrote: Fix it by calling strtoll instead, which will report ERANGE as expected. (HMP) block_set_io_throttle ide0-hd0 99 0 0 0 0 0 (HMP) block_set_io_throttle ide0-hd0 999 0 0

Re: [Qemu-devel] [PATCH] monitor: fix parsing of big int

2013-08-01 Thread Fam Zheng
On Thu, 08/01 10:00, Luiz Capitulino wrote: On Thu, 01 Aug 2013 07:52:17 -0600 Eric Blake ebl...@redhat.com wrote: On 08/01/2013 12:31 AM, Fam Zheng wrote: Fix it by calling strtoll instead, which will report ERANGE as expected. (HMP) block_set_io_throttle ide0-hd0