[PATCH 04/14] scripts/sorttable: Have the ORC code use the _r() functions to read

Steven Rostedt
2025-01-02T18:59:47Z

From: Steven Rostedt <rostedt@goodmis.org>

The ORC code reads the section information directly from the file. This
currently works because the default read function is for 64bit little
endian machines. But if for some reason that ever changes, this will
break. Instead of having a surprise breakage, use the _r() functions that
will read the values from the file properly.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
scripts/sorttable.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/sorttable.h b/scripts/sorttable.h
index aa7a8499a516..7c06a754e31a 100644
--- a/scripts/sorttable.h
+++ b/scripts/sorttable.h
@@ -296,14 +296,14 @@ static int do_sort(Elf_Ehdr *ehdr,
#if defined(SORTTABLE_64) && defined(UNWINDER_ORC_ENABLED)
/* locate the ORC unwind tables */
if (!strcmp(secstrings + idx, ".orc_unwind_ip")) {
- orc_ip_size = s->sh_size;
+ orc_ip_size = _r(&s->sh_size);
g_orc_ip_table = (int *)((void *)ehdr +
- s->sh_offset);
+ _r(&s->sh_offset));
}
if (!strcmp(secstrings + idx, ".orc_unwind")) {
- orc_size = s->sh_size;
+ orc_size = _r(&s->sh_size);
g_orc_table = (struct orc_entry *)((void *)ehdr +
- s->sh_offset);
+ _r(&s->sh_offset));
}
#endif
} /* for loop */
--
2.45.2