qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] target/sh4: Avoid shift into sign bit in update_itlb_use()


From: Richard Henderson
Subject: Re: [PATCH] target/sh4: Avoid shift into sign bit in update_itlb_use()
Date: Wed, 24 Jul 2024 10:23:10 +1000
User-agent: Mozilla Thunderbird

On 7/24/24 03:24, Peter Maydell wrote:
In update_itlb_use() the variables or_mask and and_mask are uint8_t,
which means that in expressions like "and_mask << 24" the usual C
arithmetic conversions will result in the shift being done as a
signed int type, and so we will shift into the sign bit. For QEMU
this isn't undefined behaviour because we use -fwrapv; but we can
avoid it anyway by using uint32_t types for or_mask and and_mask.

Resolves: Coverity CID 1547628
Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
---
  target/sh4/helper.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]