Skip to content

Commit 7f9b34f

Browse files
Julien ThierryPeter Zijlstra
authored andcommitted
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: 2a362ec ("objtool: Optimize find_symbol_*() and read_symbols()") Signed-off-by: Julien Thierry <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]>
1 parent df2b384 commit 7f9b34f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/objtool/elf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int symbol_by_offset(const void *key, const struct rb_node *node)
105105

106106
if (*o < s->offset)
107107
return -1;
108-
if (*o > s->offset + s->len)
108+
if (*o >= s->offset + s->len)
109109
return 1;
110110

111111
return 0;

0 commit comments

Comments
 (0)