Skip to content

Commit

Permalink
target/tricore: Use unsigned types for bitops in helper_eq_b()
Browse files Browse the repository at this point in the history
Coverity points out that in helper_eq_b() we have an int32_t 'msk'
and we end up shifting into its sign bit. This is OK for QEMU because
we use -fwrapv to give this well defined semantics, but when you look
at what this function is doing it's doing bit operations, so we
should be using an unsigned variable anyway. This also matches the
return type of the function.

Make 'ret' and 'msk' uint32_t.

Resolves: Coverity CID 1547758
Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: [email protected]
  • Loading branch information
pm215 committed Jul 29, 2024
1 parent f573ac0 commit b69c95e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions target/tricore/op_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1505,8 +1505,8 @@ uint32_t helper_sub_h(CPUTriCoreState *env, target_ulong r1, target_ulong r2)

uint32_t helper_eq_b(target_ulong r1, target_ulong r2)
{
int32_t ret;
int32_t i, msk;
uint32_t ret, msk;
int32_t i;

ret = 0;
msk = 0xff;
Expand Down

0 comments on commit b69c95e

Please sign in to comment.