qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PULL 14/14] ppc4xx: Add device models found in PPC440


From: Peter Maydell
Subject: Re: [Qemu-devel] [PULL 14/14] ppc4xx: Add device models found in PPC440 core SoCs
Date: Fri, 27 Apr 2018 13:38:22 +0100

On 16 February 2018 at 10:06, David Gibson <address@hidden> wrote:
> From: BALATON Zoltan <address@hidden>
>
> These devices are found in newer SoCs based on 440 core e.g. the 460EX
> (http://www.embeddeddeveloper.com/assets/processors/amcc/datasheets/
> PP460EX_DS2063.pdf)
>
> Signed-off-by: BALATON Zoltan <address@hidden>
> Signed-off-by: David Gibson <address@hidden>
> ---

> +static target_ulong sdram_size(uint32_t bcr)
> +{
> +    target_ulong size;
> +    int sh;
> +
> +    sh = 1024 - ((bcr >> 6) & 0x3ff);
> +    if (sh == 0) {
> +        size = -1;
> +    } else {
> +        size = 8 * M_BYTE * sh;
> +    }
> +
> +    return size;
> +}

Hi. Coverity (CID 1390588) points out that the calculation
"1024 - ((bcr >> 6) & 0x3ff" must result in a value of sh
between 1 and 1024, and therefore the "sh == 0" branch of
the if() is dead code.

Is there an error in the size calculation here?

thanks
-- PMM



reply via email to

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