Skip to content
Snippets Groups Projects
Commit 7f9b34f3 authored by Julien Thierry's avatar Julien Thierry Committed by Peter Zijlstra
Browse files

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: 2a362ecc ("objtool: Optimize find_symbol_*() and read_symbols()")
Signed-off-by: default avatarJulien Thierry <jthierry@redhat.com>
Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
parent df2b3843
Branches
No related tags found
No related merge requests found
...@@ -105,7 +105,7 @@ static int symbol_by_offset(const void *key, const struct rb_node *node) ...@@ -105,7 +105,7 @@ static int symbol_by_offset(const void *key, const struct rb_node *node)
if (*o < s->offset) if (*o < s->offset)
return -1; return -1;
if (*o > s->offset + s->len) if (*o >= s->offset + s->len)
return 1; return 1;
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment