Skip to content

Commit b296695

Browse files
jpoimboesuryasaimadhu
authored andcommitted
objtool: Make BP scratch register warning more robust
If func is NULL, a seg fault can result. This is a theoretical issue which was found by Coverity, ID: 1492002 ("Dereference after null check"). Fixes: c705cec ("objtool: Track original function across branches") Reported-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/afc628693a37acd287e843bcc5c0430263d93c74.1585761021.git.jpoimboe@redhat.com
1 parent b401efc commit b296695

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/objtool/check.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,8 +2005,8 @@ static int validate_return(struct symbol *func, struct instruction *insn, struct
20052005
}
20062006

20072007
if (state->bp_scratch) {
2008-
WARN("%s uses BP as a scratch register",
2009-
func->name);
2008+
WARN_FUNC("BP used as a scratch register",
2009+
insn->sec, insn->offset);
20102010
return 1;
20112011
}
20122012

0 commit comments

Comments
 (0)