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

Re: [Xen-devel] [PATCH 2/4] libelf: use UINT_MAX



>>> On 06.12.16 at 14:49, <roger.pau@xxxxxxxxxx> wrote:
>> --- a/xen/common/libelf/libelf-tools.c
>> +++ b/xen/common/libelf/libelf-tools.c
>> @@ -131,9 +131,10 @@ unsigned elf_shdr_count(struct elf_binar
>>  {
>>      unsigned count = elf_uval(elf, elf->ehdr, e_shnum);
>>      uint64_t max = elf->size / sizeof(Elf32_Shdr);
>> -    if (max > ~(unsigned)0)
>> -        max = ~(unsigned)0; /* Xen doesn't have limits.h :-/ */
>> -    if (count > max)
>> +
>> +    if ( max > UINT_MAX )
>> +        max = UINT_MAX;
> 
> Can't you use a min helper here? It would be clear IMHO.

I'm afraid there's no min() available that would work (build) equally
in both libxc and hypervisor context.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.