[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] target/mips: Fix potential integer overflow (CID 1452921)
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH] target/mips: Fix potential integer overflow (CID 1452921) |
Date: |
Tue, 11 May 2021 05:19:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
On 5/5/21 11:51 PM, Philippe Mathieu-Daudé wrote:
> Use the BIT_ULL() macro to ensure we use 64-bit arithmetic.
> This fixes the following Coverity issue (OVERFLOW_BEFORE_WIDEN):
>
> CID 1452921: Integer handling issues:
>
> Potentially overflowing expression "1 << w" with type "int"
> (32 bits, signed) is evaluated using 32-bit arithmetic, and
> then used in a context that expects an expression of type
> "uint64_t" (64 bits, unsigned).
>
> Fixes: 074cfcb4dae ("target/mips: Implement hardware page table walker")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> target/mips/tcg/sysemu/tlb_helper.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Thanks, applied to mips-next.