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

Re: [Xen-devel] [PATCH 14/16] libelf: use only unsigned integers



Ian Jackson writes ("[PATCH 14/16] libelf: use only unsigned integers"):
> index f96ac7a..b47a9ca 100644
> --- a/xen/common/libelf/libelf-tools.c
> +++ b/xen/common/libelf/libelf-tools.c
> @@ -119,19 +119,19 @@ uint64_t elf_access_unsigned(struct elf_binary * elf, 
> elf_ptrval base,
>  
>  uint64_t elf_round_up(struct elf_binary *elf, uint64_t addr)
>  {
> -    int elf_round = (elf_64bit(elf) ? 8 : 4) - 1;
> +    unsigned elf_round = (elf_64bit(elf) ? 8 : 4) - 1;
>  
>      return (addr + elf_round) & ~elf_round;
>  }

It has been pointed out to me that this is wrong and truncates the
value to 32-bit.  The correct fix is to change elf_round to uint64_t.

This shows a hole in the argument for the safety of this patch.

Ian.

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


 


Rackspace

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