diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-06-08 11:23:40 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-07-11 20:39:49 +0300 |
commit | cade370efe2f9e2a79ea8587506ffe2b51ac6d2b (patch) | |
tree | ffcbb1ebba28c97f8567cf3e40be9dfb7fed052f | |
parent | 1942b2eff5f949f5b992f0a50d1e0197d9941324 (diff) | |
download | linux-cade370efe2f9e2a79ea8587506ffe2b51ac6d2b.tar.xz |
modpost: fix off by one in is_executable_section()
[ Upstream commit 3a3f1e573a105328a2cca45a7cfbebabbf5e3192 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-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 30d2ebc391f4..b1163bad652a 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1296,7 +1296,7 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, static int is_executable_section(struct elf_info* elf, unsigned int section_index) { - if (section_index > elf->num_sections) + if (section_index >= elf->num_sections) fatal("section_index is outside elf->num_sections!\n"); return ((elf->sechdrs[section_index].sh_flags & SHF_EXECINSTR) == SHF_EXECINSTR); |