diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-06-08 11:23:40 +0300 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2023-06-08 16:50:04 +0300 |
commit | 3a3f1e573a105328a2cca45a7cfbebabbf5e3192 (patch) | |
tree | f27e44532e553a8cebac8bb13618bdbb070a122c /scripts/mod/modpost.c | |
parent | 98d7c7544a3a9f2713dc0f729bca4ab05fbc6e7f (diff) | |
download | linux-3a3f1e573a105328a2cca45a7cfbebabbf5e3192.tar.xz |
modpost: fix off by one in is_executable_section()
The > comparison should be >= to prevent an out of bounds array
access.
Fixes: 52dc0595d540 ("modpost: handle relocations mismatch in __ex_table.")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r-- | scripts/mod/modpost.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 3ea5eb2b1029..8decf04633bc 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1141,7 +1141,7 @@ static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym) static bool is_executable_section(struct elf_info *elf, unsigned int secndx) { - if (secndx > elf->num_sections) + if (secndx >= elf->num_sections) return false; return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0; |