diff mbox series

[v2] hw/misc: Set valid access size for Exynos4210 RNG

Message ID 20240618155159.3183256-1-zheyuma97@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v2] hw/misc: Set valid access size for Exynos4210 RNG | expand

Commit Message

Zheyu Ma June 18, 2024, 3:51 p.m. UTC
This commit ensures that accesses to the RNG memory region are properly
validated and align with expected access sizes.

Reproducer:
cat << EOF | qemu-system-aarch64 -display none \
-machine accel=qtest, -m 512M -machine smdkc210 -qtest stdio
readb 0x10830454
EOF

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
 hw/misc/exynos4210_rng.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Philippe Mathieu-Daudé June 18, 2024, 3:58 p.m. UTC | #1
On 18/6/24 17:51, Zheyu Ma wrote:
> This commit ensures that accesses to the RNG memory region are properly
> validated and align with expected access sizes.

Please point to the device specifications.

> Reproducer:
> cat << EOF | qemu-system-aarch64 -display none \
> -machine accel=qtest, -m 512M -machine smdkc210 -qtest stdio
> readb 0x10830454
> EOF
> 
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
>   hw/misc/exynos4210_rng.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/hw/misc/exynos4210_rng.c b/hw/misc/exynos4210_rng.c
> index 0756bd3205..674d8eece5 100644
> --- a/hw/misc/exynos4210_rng.c
> +++ b/hw/misc/exynos4210_rng.c
> @@ -217,6 +217,8 @@ static const MemoryRegionOps exynos4210_rng_ops = {
>       .read = exynos4210_rng_read,
>       .write = exynos4210_rng_write,
>       .endianness = DEVICE_NATIVE_ENDIAN,
> +    .valid.min_access_size = 4,
> +    .valid.max_access_size = 4,
>   };
>   
>   static void exynos4210_rng_reset(DeviceState *dev)
diff mbox series

Patch

diff --git a/hw/misc/exynos4210_rng.c b/hw/misc/exynos4210_rng.c
index 0756bd3205..674d8eece5 100644
--- a/hw/misc/exynos4210_rng.c
+++ b/hw/misc/exynos4210_rng.c
@@ -217,6 +217,8 @@  static const MemoryRegionOps exynos4210_rng_ops = {
     .read = exynos4210_rng_read,
     .write = exynos4210_rng_write,
     .endianness = DEVICE_NATIVE_ENDIAN,
+    .valid.min_access_size = 4,
+    .valid.max_access_size = 4,
 };
 
 static void exynos4210_rng_reset(DeviceState *dev)