Skip to content

Commit

Permalink
powerpc/code-patching: Fix patch_branch() return on out-of-range failure
Browse files Browse the repository at this point in the history
Do not silentely ignore a failure of create_branch() in
patch_branch(). Return -ERANGE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/8540cb64b1f06710eaf41e3835c7ba3e21fa2b05.1638446239.git.christophe.leroy@csgroup.eu
  • Loading branch information
Christophe Leroy authored and Michael Ellerman committed Dec 23, 2021
1 parent 6b21af7 commit d5937db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/powerpc/lib/code-patching.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ int patch_branch(u32 *addr, unsigned long target, int flags)
{
ppc_inst_t instr;

create_branch(&instr, addr, target, flags);
if (create_branch(&instr, addr, target, flags))
return -ERANGE;

return patch_instruction(addr, instr);
}

Expand Down

0 comments on commit d5937db

Please sign in to comment.