xemu/hw/net/rocker
Peter Maydell 7cf745dd9c hw/net/rocker: Avoid undefined shifts with more than 31 ports
In rocker_port_phys_link_status() and rocker_port_phys_enable_read()
we construct a 64-bit value with one bit per front-panel port.
However we accidentally do the shift as 32-bit arithmetic, which
means that if there are more than 31 front-panel ports this is
undefined behaviour.

Fix the problem by ensuring we use 64-bit arithmetic for the whole
calculation. (We won't ever shift off the 64-bit value because
ROCKER_FP_PORTS_MAX is 62.)

Resolves: Coverity CID 1487121, 1487160
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2022-08-09 17:02:18 +08:00
..
qmp-norocker.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
rocker_desc.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
rocker_desc.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
rocker_fp.c rocker: Revamp fp_port_get_info 2020-12-19 10:14:52 +01:00
rocker_fp.h rocker: Revamp fp_port_get_info 2020-12-19 10:14:52 +01:00
rocker_hw.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
rocker_of_dpa.c qapi: Use QAPI_LIST_PREPEND() where possible 2020-12-19 10:20:14 +01:00
rocker_of_dpa.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
rocker_tlv.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
rocker_world.c net/rocker: Remove the dead error handling 2017-09-08 08:17:37 +08:00
rocker_world.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
rocker.c hw/net/rocker: Avoid undefined shifts with more than 31 ports 2022-08-09 17:02:18 +08:00
rocker.h Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00