Skip to content

Commit 69d41d6

Browse files
jpoimboeIngo Molnar
authored andcommitted
objtool: Fix segfault in ignore_unreachable_insn()
Check 'prev_insn' before dereferencing it. Fixes: bd841d6 ("objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings") Reported-by: Arnd Bergmann <[email protected]> Reported-by: Ingo Molnar <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/5df4ff89c9e4b9e788b77b0531234ffa7ba03e9e.1743136205.git.jpoimboe@kernel.org Closes: https://lore.kernel.org/[email protected] Closes: https://lore.kernel.org/[email protected]
1 parent d9a595c commit 69d41d6

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
@@ -4037,7 +4037,7 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio
40374037
* It may also insert a UD2 after calling a __noreturn function.
40384038
*/
40394039
prev_insn = prev_insn_same_sec(file, insn);
4040-
if (prev_insn->dead_end &&
4040+
if (prev_insn && prev_insn->dead_end &&
40414041
(insn->type == INSN_BUG ||
40424042
(insn->type == INSN_JUMP_UNCONDITIONAL &&
40434043
insn->jump_dest && insn->jump_dest->type == INSN_BUG)))

0 commit comments

Comments
 (0)