summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.ibm.com>2024-01-17 13:50:46 +0300
committerAlexander Gordeev <agordeev@linux.ibm.com>2024-04-17 14:38:02 +0300
commitea84f14d2a6b1a4fde17d2713dbdfdef7b84da87 (patch)
tree798b7a03414dfe3a4d653b3b556d4b15c4cf546d
parent236d70f82bec6e1f3ab50a5242fc1c7f779e941e (diff)
downloadlinux-ea84f14d2a6b1a4fde17d2713dbdfdef7b84da87.tar.xz
s390/nospec: Correct modules thunk offset calculation
Fix offset calculation when branch target is more then 2Gb away. Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-rw-r--r--arch/s390/kernel/nospec-branch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/s390/kernel/nospec-branch.c b/arch/s390/kernel/nospec-branch.c
index d1b16d83e49a..9b8c24ebb008 100644
--- a/arch/s390/kernel/nospec-branch.c
+++ b/arch/s390/kernel/nospec-branch.c
@@ -114,10 +114,10 @@ static void __init_or_module __nospec_revert(s32 *start, s32 *end)
type = BRASL_EXPOLINE; /* brasl instruction */
else
continue;
- thunk = instr + (*(int *)(instr + 2)) * 2;
+ thunk = instr + (long)(*(int *)(instr + 2)) * 2;
if (thunk[0] == 0xc6 && thunk[1] == 0x00)
/* exrl %r0,<target-br> */
- br = thunk + (*(int *)(thunk + 2)) * 2;
+ br = thunk + (long)(*(int *)(thunk + 2)) * 2;
else
continue;
if (br[0] != 0x07 || (br[1] & 0xf0) != 0xf0)