]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: relocate-rela: adjust le64_to_cpu -> le32_to_cpu in decode_elf32()
authorOvidiu Panait <ovpanait@gmail.com>
Sat, 11 Mar 2023 17:38:34 +0000 (19:38 +0200)
committerMichal Simek <michal.simek@amd.com>
Mon, 13 Mar 2023 10:46:17 +0000 (11:46 +0100)
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")
Reviewed-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20230311173838.521804-1-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
tools/relocate-rela.c

index 2d2a2ed2772c1e4178b2564cc6e2efa74c1093e8..689e2d465592db1dc6287807f48472c6f9c44f0d 100644 (file)
@@ -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");