On 16 February 2018 at 10:06, David Gibson <[email protected]> wrote:
> From: BALATON Zoltan <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: David Gibson <[email protected]>
> ---
> +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