[PATCH] platform: generic: Terminate platform.name with null
Anup Patel
anup at brainfault.org
Tue Jul 6 01:57:06 PDT 2021
On Sun, Jul 4, 2021 at 8:31 PM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> fw_platform_init() fills platform.name without considering the
> ending null character. Fix it.
>
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
Looks good to me.
Reviewed-by: Anup Patel <anup.patel at wdc.com>
Applied this patch to the riscv/opensbi repo
Thanks,
Anup
> ---
>
> platform/generic/platform.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> index da0c1af..79d5230 100644
> --- a/platform/generic/platform.c
> +++ b/platform/generic/platform.c
> @@ -85,7 +85,7 @@ unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1,
>
> model = fdt_getprop(fdt, root_offset, "model", &len);
> if (model)
> - sbi_strncpy(platform.name, model, sizeof(platform.name));
> + sbi_strncpy(platform.name, model, sizeof(platform.name) - 1);
>
> if (generic_plat && generic_plat->features)
> platform.features = generic_plat->features(generic_plat_match);
> --
> 2.25.1
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list