summaryrefslogtreecommitdiffstats
path: root/tools/objtool/elf.c
diff options
context:
space:
mode:
authorJulien Thierry <jthierry@redhat.com>2020-04-03 15:17:30 +0200
committerIngo Molnar <mingo@kernel.org>2020-04-22 10:53:49 +0200
commit5377cae94ae31b089d4a69e7706672501c974f4d (patch)
tree1ef18a8b85549cc38e021ba4104c8b84bc32f8a6 /tools/objtool/elf.c
parentobjtool: Fix 32bit cross builds (diff)
downloadlinux-5377cae94ae31b089d4a69e7706672501c974f4d.tar.xz
linux-5377cae94ae31b089d4a69e7706672501c974f4d.zip
objtool: Fix off-by-one in symbol_by_offset()
Sometimes, WARN_FUNC() and other users of symbol_by_offset() will associate the first instruction of a symbol with the symbol preceding it. This is because symbol->offset + symbol->len is already outside of the symbol's range. Fixes: 2a362ecc3ec9 ("objtool: Optimize find_symbol_*() and read_symbols()") Signed-off-by: Julien Thierry <jthierry@redhat.com> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to '')
-rw-r--r--tools/objtool/elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 09ddc8f1def3..c4857fa3f1d1 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -105,7 +105,7 @@ static int symbol_by_offset(const void *key, const struct rb_node *node)
if (*o < s->offset)
return -1;
- if (*o > s->offset + s->len)
+ if (*o >= s->offset + s->len)
return 1;
return 0;