Re: [PATCH] conf: handle 'vda[-1]' uniformly

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

 



On 04/30/2014 01:01 AM, Peter Krempa wrote:
> On 04/30/14 06:22, Eric Blake wrote:
>> Commit f22b7899 stumbled across a difference between 32-bit and
>> 64-bit platforms; on 64-bit, parsing "-1" as a long produces
>> 0xffffffffffffffff, which does not fit in unsigned int; but on
>> 32-bit, it parses as 0xffffffff, which DOES fit.  Another patch
>> will tweak virStrToLong_ui to behave the same across platforms,
>> but regardless of which of the two choices it makes, the chain
>> lookup code wants to reject negative numbers rather than treating
>> it as large integers.
>>

> I'd rather see a wrapper that rejects negative numbers when parsing into
> a unsigned type rather than having it silently convert the number to a
> negative one.
> 
> I know that there are places where this is desired, but they should be
> fixed to explicitly use a differnent func.
> 
>> +        virStrToLong_ui(strings[1], &suffix, 10, &idx) < 0 ||
>>          STRNEQ(suffix, "]"))
>>          goto cleanup;
>>
> 
> I'm inclined to NACK this change.

Fair enough, v2 posted.
https://www.redhat.com/archives/libvir-list/2014-May/msg00000.html

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]