Skip to content

Commit a23e758

Browse files
committed
modpost: unify 'sym' and 'to' in default_mismatch_handler()
find_tosym() takes 'sym' and stores the return value to another variable 'to'. You can use the same variable because we want to replace the original one when appropriate. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]>
1 parent 05bb070 commit a23e758

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

scripts/mod/modpost.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,20 +1185,19 @@ static bool is_executable_section(struct elf_info *elf, unsigned int secndx)
11851185

11861186
static void default_mismatch_handler(const char *modname, struct elf_info *elf,
11871187
const struct sectioncheck* const mismatch,
1188-
Elf_Rela *r, Elf_Sym *sym,
1188+
Elf_Rela *r, Elf_Sym *tsym,
11891189
unsigned int fsecndx, const char *fromsec,
11901190
const char *tosec)
11911191
{
1192-
Elf_Sym *to;
11931192
Elf_Sym *from;
11941193
const char *tosym;
11951194
const char *fromsym;
11961195

11971196
from = find_fromsym(elf, r->r_offset, fsecndx);
11981197
fromsym = sym_name(elf, from);
11991198

1200-
to = find_tosym(elf, r->r_addend, sym);
1201-
tosym = sym_name(elf, to);
1199+
tsym = find_tosym(elf, r->r_addend, tsym);
1200+
tosym = sym_name(elf, tsym);
12021201

12031202
/* check whitelist - we may ignore it */
12041203
if (!secref_whitelist(fromsec, fromsym, tosec, tosym))
@@ -1233,7 +1232,7 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
12331232
"You might get more information about where this is\n"
12341233
"coming from by using scripts/check_extable.sh %s\n",
12351234
fromsec, (long)r->r_offset, tosec, modname);
1236-
else if (is_executable_section(elf, get_secindex(elf, sym)))
1235+
else if (is_executable_section(elf, get_secindex(elf, tsym)))
12371236
warn("The relocation at %s+0x%lx references\n"
12381237
"section \"%s\" which is not in the list of\n"
12391238
"authorized sections. If you're adding a new section\n"

0 commit comments

Comments
 (0)