[PATCH] platform: openpiton: fix uninitialized plic_data struct

Anup Patel anup at brainfault.org
Tue Jul 22 03:36:01 PDT 2025


On Wed, Jul 9, 2025 at 1:10 AM Manuel Hernández Méndez
<maherme.dev at gmail.com> wrote:
>
> The plic_data struct was uninitialized. This led to misfunction behavior
> since it was subsequently assigned to the global plic struct, and some
> struct fields, such as flags and irqchip, contained random values.
> The fix proposes to initialize the plic_data to the global plic struct,
> so, after parsing the fdt, the fields of the struct will be set to the
> default values set in global plic struct definition, or the parsed values
> in the fdt, or zero.
>
> Fixes: 4c37451 ("platform: openpiton: Read the device configurations from
> device tree")
> Signed-off-by: Manuel Hernández Méndez <maherme.dev at gmail.com>

LGTM.

Reviewed-by: Anup Patel <anup at brainfault.org>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  platform/fpga/openpiton/platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/platform/fpga/openpiton/platform.c b/platform/fpga/openpiton/platform.c
> index d2cf3e32..faa299ce 100644
> --- a/platform/fpga/openpiton/platform.c
> +++ b/platform/fpga/openpiton/platform.c
> @@ -79,7 +79,7 @@ static int openpiton_early_init(bool cold_boot)
>  {
>         const void *fdt;
>         struct platform_uart_data uart_data = { 0 };
> -       struct plic_data plic_data;
> +       struct plic_data plic_data = plic;
>         unsigned long aclint_freq;
>         uint64_t clint_addr;
>         int rc;
> --
> 2.34.1
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list