OSDN Git Service

target/s390x: Fix the accumulation of ccm in op_icm
authorRichard Henderson <richard.henderson@linaro.org>
Fri, 1 Apr 2022 19:36:59 +0000 (13:36 -0600)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 27 Apr 2022 02:58:43 +0000 (19:58 -0700)
Coverity rightly reports that 0xff << pos can overflow.
This would affect the ICMH instruction.

Fixes: Coverity CID 1487161
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220401193659.332079-1-richard.henderson@linaro.org>

target/s390x/tcg/translate.c

index ae70368..8f092da 100644 (file)
@@ -2622,7 +2622,7 @@ static DisasJumpType op_icm(DisasContext *s, DisasOps *o)
                 tcg_gen_qemu_ld8u(tmp, o->in2, get_mem_index(s));
                 tcg_gen_addi_i64(o->in2, o->in2, 1);
                 tcg_gen_deposit_i64(o->out, o->out, tmp, pos, 8);
-                ccm |= 0xff << pos;
+                ccm |= 0xffull << pos;
             }
             m3 = (m3 << 1) & 0xf;
             pos -= 8;