[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/6] target/i386: Suppress coverity warning on fsave/frstor
From: |
Richard Henderson |
Subject: |
[PULL 3/6] target/i386: Suppress coverity warning on fsave/frstor |
Date: |
Tue, 26 Apr 2022 21:39:39 -0700 |
Coverity warns that 14 << data32 may overflow with respect
to the target_ulong to which it is subsequently added.
We know this wasn't true because data32 is in [1,2],
but the suggested fix is perfectly fine.
Fixes: Coverity CID 1487135, 1487256
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Message-Id: <20220401184635.327423-1-richard.henderson@linaro.org>
---
target/i386/tcg/fpu_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
index ebf5e73df9..30bc44fcf8 100644
--- a/target/i386/tcg/fpu_helper.c
+++ b/target/i386/tcg/fpu_helper.c
@@ -2466,7 +2466,7 @@ static void do_fsave(CPUX86State *env, target_ulong ptr,
int data32,
do_fstenv(env, ptr, data32, retaddr);
- ptr += (14 << data32);
+ ptr += (target_ulong)14 << data32;
for (i = 0; i < 8; i++) {
tmp = ST(i);
do_fstt(env, tmp, ptr, retaddr);
@@ -2488,7 +2488,7 @@ static void do_frstor(CPUX86State *env, target_ulong ptr,
int data32,
int i;
do_fldenv(env, ptr, data32, retaddr);
- ptr += (14 << data32);
+ ptr += (target_ulong)14 << data32;
for (i = 0; i < 8; i++) {
tmp = do_fldt(env, ptr, retaddr);
--
2.34.1
- [PULL 0/6] Coverity patch queue, Richard Henderson, 2022/04/27
- [PULL 3/6] target/i386: Suppress coverity warning on fsave/frstor,
Richard Henderson <=
- [PULL 1/6] accel/tcg: Assert mmu_idx in range before use in cputlb, Richard Henderson, 2022/04/27
- [PULL 4/6] softfloat: Fix declaration of partsN_compare, Richard Henderson, 2022/04/27
- [PULL 2/6] target/s390x: Fix the accumulation of ccm in op_icm, Richard Henderson, 2022/04/27
- [PULL 5/6] softfloat: Use FloatRelation within partsN_compare, Richard Henderson, 2022/04/27
- [PULL 6/6] softfloat: Use FloatRelation for fracN_cmp, Richard Henderson, 2022/04/27
- Re: [PULL 0/6] Coverity patch queue, Richard Henderson, 2022/04/27