Skip to content

Commit af649c4

Browse files
chleroysmb49
authored andcommitted
objtool: Fix SEGFAULT
BugLink: https://bugs.launchpad.net/bugs/2003914 [ 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 <naveen.n.rao@linux.vnet.ibm.com> Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20221114175754.1131267-9-sv@linux.ibm.com Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 2d633f6 commit af649c4

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
@@ -162,7 +162,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
162162
return false;
163163

164164
insn = find_insn(file, func->sec, func->offset);
165-
if (!insn->func)
165+
if (!insn || !insn->func)
166166
return false;
167167

168168
func_for_each_insn_all(file, func, insn) {

0 commit comments

Comments
 (0)