[PATCH 4/5] lib: fix fdt_parse_plicsw_node()

Xiang W wxjstz at 126.com
Sat Nov 26 04:51:59 PST 2022


在 2022-11-25星期五的 15:08 +0100,Heinrich Schuchardt写道:
> cpu_offset and cpu_intc_offset must be int to detect failed invocations of
> fdt_node_offset_by_phandle() or fdt_parent_offset().
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
https://github.com/riscv-software-src/opensbi/blob/master/lib/utils/fdt/fdt_helper.c#L891
if (cpu_intc_offset < 0) should be if (cpu_offset < 0)

Regards,
Xiang W
> ---
>  lib/utils/fdt/fdt_helper.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c
> index ea969e5..da96282 100644
> --- a/lib/utils/fdt/fdt_helper.c
> +++ b/lib/utils/fdt/fdt_helper.c
> @@ -861,7 +861,7 @@ int fdt_parse_plicsw_node(void *fdt, int nodeoffset, unsigned long *plicsw_base,
>  {
>         const fdt32_t *val;
>         int rc, i, count;
> -       uint64_t reg_addr, reg_size, cpu_offset, cpu_intc_offset;
> +       uint64_t reg_addr, reg_size;
>         u32 phandle, hwirq, hartid, hcount;
>  
>         if (nodeoffset < 0 || !fdt || !plicsw_base ||
> @@ -882,6 +882,8 @@ int fdt_parse_plicsw_node(void *fdt, int nodeoffset, unsigned long *plicsw_base,
>  
>         hcount = 0;
>         for (i = 0; i < (count / 2); i++) {
> +               int cpu_offset, cpu_intc_offset;
> +
>                 phandle = fdt32_to_cpu(val[2 * i]);
>                 hwirq = fdt32_to_cpu(val[2 * i + 1]);
>  
> -- 
> 2.37.2
> 
> 





More information about the opensbi mailing list