qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 16/41] Add RPi4 RNG200


From: Peter Maydell
Subject: Re: [PATCH v5 16/41] Add RPi4 RNG200
Date: Fri, 23 Feb 2024 17:06:37 +0000

On Mon, 19 Feb 2024 at 01:20, Sergey Kambalin <serg.oker@gmail.com> wrote:
>
> Signed-off-by: Sergey Kambalin <sergey.kambalin@auriga.com>
> ---
>  hw/arm/bcm2838.c                     |   4 +
>  hw/arm/bcm2838_peripherals.c         |  14 +
>  hw/arm/raspi4b.c                     |   1 -
>  hw/misc/bcm2838_rng200.c             | 405 +++++++++++++++++++++++++++
>  hw/misc/meson.build                  |   1 +
>  hw/misc/trace-events                 |   9 +
>  include/hw/arm/bcm2838_peripherals.h |   2 +
>  include/hw/misc/bcm2838_rng200.h     |  43 +++
>  8 files changed, 478 insertions(+), 1 deletion(-)
>  create mode 100644 hw/misc/bcm2838_rng200.c
>  create mode 100644 include/hw/misc/bcm2838_rng200.h

Compiling with clang detects an off-by-one-error in this patch:

../../hw/misc/bcm2838_rng200.c:119:32: error: array index 9 is past
the end of the array (which contains 9 elements)
[-Werror,-Warray-bounds]
        fifo_thld = FIELD_EX32(s->regs[R_RNG_FIFO_COUNT],
                               ^       ~~~~~~~~~~~~~~~~

This is because N_BCM2838_RNG200_REGS is 9, but
R_RNG_FIFO_COUNT is 0x24 / 4 == 9.

N_BCM2838_RNG200_REGS should be 10. (The regs[] array has
an empty slot for the 0x14 offset.)

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]