summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2021-12-02 13:00:22 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2021-12-23 22:35:24 +1100
commitd5937db114e4b6446c62809484729955f1aeb108 (patch)
tree705f3864eb8dc1d85e9a464eee8ef6492dcd4fe1 /arch/powerpc/lib
parent6b21af74495b556f9d496d97d74e7a3d0ab16d7c (diff)
downloadlinux-d5937db114e4b6446c62809484729955f1aeb108.tar.gz
linux-d5937db114e4b6446c62809484729955f1aeb108.tar.bz2
linux-d5937db114e4b6446c62809484729955f1aeb108.zip
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 <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
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/code-patching.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index 3da7224fbd6e..998aeb9e1aac 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -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);
}