[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/12] target/s390x: Fix relative long instructions with large of
From: |
Ilya Leoshkevich |
Subject: |
[PATCH 07/12] target/s390x: Fix relative long instructions with large offsets |
Date: |
Mon, 3 Jul 2023 17:50:33 +0200 |
The expression "imm * 2" in gen_ri2() can wrap around if imm is large
enough.
Fix by casting imm to int64_t, like it's done in disas_jdest().
Fixes: e8ecdfeb30f0 ("Fix EXECUTE of relative branches")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
target/s390x/tcg/translate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index a6079ab7b4f..6661b27efa4 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -5794,7 +5794,7 @@ static TCGv gen_ri2(DisasContext *s)
disas_jdest(s, i2, is_imm, imm, ri2);
if (is_imm) {
- ri2 = tcg_constant_i64(s->base.pc_next + imm * 2);
+ ri2 = tcg_constant_i64(s->base.pc_next + (int64_t)imm * 2);
}
return ri2;
--
2.41.0
- Re: [PATCH 01/12] linux-user: elfload: Add more initial s390x PSW bits, (continued)
- [PATCH 06/12] target/s390x: Fix LRA when DAT is off, Ilya Leoshkevich, 2023/07/03
- [PATCH 07/12] target/s390x: Fix relative long instructions with large offsets,
Ilya Leoshkevich <=
- [PATCH 08/12] tests/tcg/s390x: Test EPSW, Ilya Leoshkevich, 2023/07/03
- [PATCH 09/12] tests/tcg/s390x: Test LARL with a large offset, Ilya Leoshkevich, 2023/07/03
- [PATCH 10/12] tests/tcg/s390x: Test LRA, Ilya Leoshkevich, 2023/07/03
- [PATCH 11/12] tests/tcg/s390x: Test MDEB and MDEBR, Ilya Leoshkevich, 2023/07/03
- [PATCH 12/12] tests/tcg/s390x: Test MVCRL with a large value in R0, Ilya Leoshkevich, 2023/07/03