Skip to content

Commit 3a3f1e5

Browse files
Dan Carpentermasahir0y
authored andcommitted
modpost: fix off by one in is_executable_section()
The > comparison should be >= to prevent an out of bounds array access. Fixes: 52dc059 ("modpost: handle relocations mismatch in __ex_table.") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 98d7c75 commit 3a3f1e5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/mod/modpost.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym)
11411141

11421142
static bool is_executable_section(struct elf_info *elf, unsigned int secndx)
11431143
{
1144-
if (secndx > elf->num_sections)
1144+
if (secndx >= elf->num_sections)
11451145
return false;
11461146

11471147
return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0;

0 commit comments

Comments
 (0)