libelf: use UINT_MAX While Xen indeed doesn't have limits.h, it still does have UINT_MAX, so we should avoid open coding it (and perhaps - even if unlikely - getting it wrong). Signed-off-by: Jan Beulich --- a/xen/common/libelf/libelf-private.h +++ b/xen/common/libelf/libelf-private.h @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef __sun__ #include #define bswap_16(x) BSWAP_16(x) --- 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; + if ( count > max ) { elf_mark_broken(elf, "far too many section headers"); count = max;