]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/misc/bcm2835_rng: Specify valid memory access sizes
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 1 May 2026 16:27:00 +0000 (17:27 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 7 May 2026 14:14:58 +0000 (15:14 +0100)
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

hw/misc/bcm2835_rng.c

index e4d2c224c887f8a2d527001a96d065be781b42cc..4492e325b4863361235184e55dbc61067c44f7e1 100644 (file)
@@ -93,6 +93,10 @@ static const MemoryRegionOps bcm2835_rng_ops = {
     .read = bcm2835_rng_read,
     .write = bcm2835_rng_write,
     .endianness = DEVICE_NATIVE_ENDIAN,
+    .impl.min_access_size = 4,
+    .impl.max_access_size = 4,
+    .valid.min_access_size = 4,
+    .valid.max_access_size = 4,
 };
 
 static const VMStateDescription vmstate_bcm2835_rng = {