qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 2/2] accel/tcg: avoid integer overflow


From: Peter Maydell
Subject: Re: [PATCH 2/2] accel/tcg: avoid integer overflow
Date: Mon, 16 Mar 2020 12:55:31 +0000

On Mon, 16 Mar 2020 at 12:14, Yifei Jiang <address@hidden> wrote:
>
> This fixes coverity issues 75235919, etc.,
>     1524    /* Handle CPU specific unaligned behaviour */
> CID 75235919: (OVERFLOW_BEFORE_WIDEN)
>     1525. overflow_before_widen: Potentially overflowing expression "1 << 
> a_bits" with type "int" (32 bits, signed) is evaluated using 32-bit 
> arithmetic, and then used in a context that expects an expression of type 
> "target_ulong" (64 bits, unsigned).
>     1525    if (addr & ((1 << a_bits) - 1)) {

This is a Coverity false positive. The value of a_bits in
these cases can never be big enough for 1 << a_bits
to overflow, because it indicates an alignment requirement
and will at most be 6 (indicating a 64-byte-alignment).

thanks
-- PMM



reply via email to

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