@samitouri / QOSamiQemu / commits / 18b664c900

hw/misc/bcm2835_rng: Specify valid memory access sizes

The BCM2835 RNG has 32-bit registers only; specify this in the MemoryRegionOps so wrong-sized accesses are rejected rather than getting to the assertions in the read and write functions, and for clarity add the matching .impl constraints. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3394 Fixes: 54a5ba13a9f ("target-arm: Implement BCM2835 hardware RNG") Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20260501162700.4092512-1-peter.maydell@linaro.org

Peter Maydell committed May 1, 2026 at 17:27 UTC 18b664c90085b0d2be9c2ad8c747e00a7a733402
1 file changed +4
hw/misc/bcm2835_rng.c
+4
@@ -93,6 +93,10 @@ static const MemoryRegionOps bcm2835_rng_ops = {
93 .read = bcm2835_rng_read,
94 .write = bcm2835_rng_write,
95 .endianness = DEVICE_NATIVE_ENDIAN,
96 + .impl.min_access_size = 4,
97 + .impl.max_access_size = 4,
98 + .valid.min_access_size = 4,
99 + .valid.max_access_size = 4,
100 };
101
102 static const VMStateDescription vmstate_bcm2835_rng = {