Re: [Qemu-devel] [PATCH 04/14] qemu-nbd: Simplify --partition handling

2018-12-10 Thread Eric Blake
On 11/30/18 4:03 PM, Eric Blake wrote: Our open-coding of strtol handling forgot to handle overflow conditions. What's more, since we insiste on a user-supplied partition to be non-zero, we can use 0 rather than -1 for our initial value to distinguish when a partition is not being served, for

Re: [Qemu-devel] [PATCH 04/14] qemu-nbd: Simplify --partition handling

2018-12-05 Thread Eric Blake
On 12/5/18 10:26 AM, Eric Blake wrote: is it possible, that "char *ep" remains uninitialized, and than we access it in check_strtox_error? I don's see in strtol spec a guarantee of setting endptr on failure path. C99 7.10.1.4 P5-7 requires strtoll() and friends to assign through 'endptr'

Re: [Qemu-devel] [PATCH 04/14] qemu-nbd: Simplify --partition handling

2018-12-05 Thread Eric Blake
On 12/5/18 9:40 AM, Vladimir Sementsov-Ogievskiy wrote: 01.12.2018 1:03, Eric Blake wrote: Our open-coding of strtol handling forgot to handle overflow conditions. What's more, since we insiste on a user-supplied partition to be non-zero, we can use 0 rather than -1 for our initial value to

Re: [Qemu-devel] [PATCH 04/14] qemu-nbd: Simplify --partition handling

2018-12-05 Thread Vladimir Sementsov-Ogievskiy
01.12.2018 1:03, Eric Blake wrote: > Our open-coding of strtol handling forgot to handle overflow > conditions. What's more, since we insiste on a user-supplied > partition to be non-zero, we can use 0 rather than -1 for our > initial value to distinguish when a partition is not being > served,

Re: [Qemu-devel] [PATCH 04/14] qemu-nbd: Simplify --partition handling

2018-11-30 Thread Eric Blake
On 11/30/18 4:26 PM, Richard W.M. Jones wrote: On Fri, Nov 30, 2018 at 04:03:33PM -0600, Eric Blake wrote: Our open-coding of strtol handling forgot to handle overflow conditions. What's more, since we insiste on a user-supplied "insist" (Ever wonder if I stick in a typo on purpose, just to

Re: [Qemu-devel] [PATCH 04/14] qemu-nbd: Simplify --partition handling

2018-11-30 Thread Richard W.M. Jones
On Fri, Nov 30, 2018 at 04:03:33PM -0600, Eric Blake wrote: > Our open-coding of strtol handling forgot to handle overflow > conditions. What's more, since we insiste on a user-supplied "insist" > partition to be non-zero, we can use 0 rather than -1 for our > initial value to distinguish when a

[Qemu-devel] [PATCH 04/14] qemu-nbd: Simplify --partition handling

2018-11-30 Thread Eric Blake
Our open-coding of strtol handling forgot to handle overflow conditions. What's more, since we insiste on a user-supplied partition to be non-zero, we can use 0 rather than -1 for our initial value to distinguish when a partition is not being served, for slightly more optimal code. Signed-off-by: