Skip to content

Commit d5937db

Browse files
chleroympe
authored andcommitted
powerpc/code-patching: Fix patch_branch() return on out-of-range failure
Do not silentely ignore a failure of create_branch() in patch_branch(). Return -ERANGE. Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/8540cb64b1f06710eaf41e3835c7ba3e21fa2b05.1638446239.git.christophe.leroy@csgroup.eu
1 parent 6b21af7 commit d5937db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/powerpc/lib/code-patching.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ int patch_branch(u32 *addr, unsigned long target, int flags)
191191
{
192192
ppc_inst_t instr;
193193

194-
create_branch(&instr, addr, target, flags);
194+
if (create_branch(&instr, addr, target, flags))
195+
return -ERANGE;
196+
195197
return patch_instruction(addr, instr);
196198
}
197199

0 commit comments

Comments
 (0)