qemu/hw/m68k
Peter Maydell c3ade30ac1 hw/m68k/mcf5208: Avoid shifting off end of integer
In m5208_sys_read(), we have a loop of n from 0 to 31, and we
calculate (2u << n).  For the n == 31 iteration this will shift off
the top of the unsigned 32 bit integer.

This is harmless, because we're going to stop the loop with n == 31
anyway, but we can avoid the error by using 64-bit arithmetic here.

(The SDCS0 register is documented at
https://www.nxp.com/docs/en/reference-manual/MCF5208RM.pdf
section 18.4.5; we want the lower 5 bits to indicate the
RAM size, where 31 == 4GB, 30 == 2GB, and so on down.
As it happens, the layout of the mcf5208evb board memory map
means it doesn't make sense to have more than 1GB of RAM
in any case.)

Resolves: Coverity CID 1547727
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Message-ID: <20240830173452.2086140-2-peter.maydell@linaro.org>
Signed-off-by: Thomas Huth <huth@tuxfamily.org>
2024-09-08 11:35:43 +02:00
..
an5206.c hw/m68k/mcf5206: Pass CPU using QOM link property 2023-11-01 07:20:34 +01:00
bootinfo.h hw/m68k: Clean up local variable shadowing 2023-09-29 10:07:15 +02:00
Kconfig m68k: switch boards to "default y" 2024-05-03 15:47:47 +02:00
mcf5206.c hw/m68k/mcf5206: Embed m5206_timer_state in m5206_mbar_state 2024-01-05 16:20:15 +01:00
mcf5208.c hw/m68k/mcf5208: Avoid shifting off end of integer 2024-09-08 11:35:43 +02:00
mcf_intc.c hw/m68k/mcf_intc: Pass CPU using QOM link property 2023-11-01 07:20:34 +01:00
meson.build q800: move GLUE device into separate q800-glue.c file 2023-06-22 09:21:57 +02:00
next-cube.c hw/m68k: Constify VMState 2023-12-30 07:38:05 +11:00
next-kbd.c other architectures: spelling fixes 2023-07-25 17:14:07 +03:00
q800-glue.c hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
q800.c hw/m68k/q800: use qemu_find_nic_info() 2024-02-02 16:23:47 +00:00
virt.c hw: add compat machines for 9.2 2024-09-05 13:12:36 +01:00