[PATCH 1/5] tools: relocate-rela: adjust le64_to_cpu -> le32_to_cpu in decode_elf32()

Michal Simek michal.simek at amd.com
Wed Mar 8 13:05:29 CET 2023



On 3/5/23 18:49, Ovidiu Panait wrote:
> The sh_addr/sh_offset/sh_size fields in Elf32_Shdr are 32-bits wide, so
> use le32_to_cpu() instead of the 64-bit variant.
> 
> Fixes: 5e0e1a86d327 ("tools: relocate-rela: Fix ELF decoding on big-endian hosts")
> Signed-off-by: Ovidiu Panait <ovpanait at gmail.com>
> ---
> 
>   tools/relocate-rela.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
> index 2d2a2ed277..689e2d4655 100644
> --- a/tools/relocate-rela.c
> +++ b/tools/relocate-rela.c
> @@ -316,9 +316,9 @@ static int decode_elf32(FILE *felf, char **argv)
>   
>   		debug("%s\n", sh_name);
>   
> -		sh_addr = le64_to_cpu(sh_table[i].sh_addr);
> -		sh_offset = le64_to_cpu(sh_table[i].sh_offset);
> -		sh_size = le64_to_cpu(sh_table[i].sh_size);
> +		sh_addr = le32_to_cpu(sh_table[i].sh_addr);
> +		sh_offset = le32_to_cpu(sh_table[i].sh_offset);
> +		sh_size = le32_to_cpu(sh_table[i].sh_size);
>   
>   		if (!strcmp(".rela.dyn", sh_name)) {
>   			debug("Found section\t\".rela_dyn\"\n");

Reviewed-by: Michal Simek <michal.simek at amd.com>

Thanks,
Michal


More information about the U-Boot mailing list