Skip to content

Commit 23a249b

Browse files
chleroygregkh
authored andcommitted
objtool: Fix SEGFAULT
[ Upstream commit efb11fd ] find_insn() will return NULL in case of failure. Check insn in order to avoid a kernel Oops for NULL pointer dereference. Tested-by: Naveen N. Rao <[email protected]> Reviewed-by: Naveen N. Rao <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent ed686e7 commit 23a249b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/objtool/check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
197197
return false;
198198

199199
insn = find_insn(file, func->sec, func->offset);
200-
if (!insn->func)
200+
if (!insn || !insn->func)
201201
return false;
202202

203203
func_for_each_insn(file, func, insn) {

0 commit comments

Comments
 (0)