qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 1/3] qemu-io: fix cvtnum lval types


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 1/3] qemu-io: fix cvtnum lval types
Date: Mon, 26 Oct 2015 16:51:20 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/26/2015 04:40 PM, Eric Blake wrote:
> On 10/26/2015 04:06 PM, John Snow wrote:
>> cvtnum() returns int64_t: we should not be storing this
>> result inside of an int.
>>
>> In a few cases, we need an extra sprinkling of error handling
>> where we expect to pass this number on towards a function that
>> expects something smaller than int64_t.
>>
>> Signed-off-by: John Snow <address@hidden>
>> ---
>>  qemu-io-cmds.c | 30 ++++++++++++++++--------------
>>  1 file changed, 16 insertions(+), 14 deletions(-)
>>
> 
>> @@ -2191,10 +2190,13 @@ static const cmdinfo_t sigraise_cmd = {
>>  
>>  static int sigraise_f(BlockBackend *blk, int argc, char **argv)
>>  {
>> -    int sig = cvtnum(argv[1]);
>> +    int64_t sig = cvtnum(argv[1]);
>>      if (sig < 0) {
>>          printf("non-numeric signal number argument -- %s\n", argv[1]);
>>          return 0;
> 
> Pre-existing: attempting to raise signal -1 claims that -1 is
> non-numeric.  Not the end of the world.

I stand corrected; cvtnum() returns -ERANGE if the user attempted to
parse the string "-1" (that is, negative user input is not permitted, so
we always have a sane errno value).  [must be time for me to quit and
eat some dinner...]

> 
> Reviewed-by: Eric Blake <address@hidden>
>

And of course this still stands.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]