[Skiboot] [PATCH 1/2] nvram: nvram_query do not run if no nvram was found

Oliver oohall at gmail.com
Mon Mar 26 10:50:31 AEDT 2018


On Sun, Mar 25, 2018 at 11:48 AM, Nicholas Piggin <npiggin at gmail.com> wrote:
> If nvram_check fails, leaving skiboot_part_hdr == NULL, do not
> have nvram_query proceed using that pointer, just return NULL.

Shouldn't the checking in nvram_validate() catch that case? If not we
should probably fix it there.

> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
>  core/nvram-format.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/core/nvram-format.c b/core/nvram-format.c
> index 3d030a30..ed8af561 100644
> --- a/core/nvram-format.c
> +++ b/core/nvram-format.c
> @@ -216,6 +216,9 @@ const char *nvram_query(const char *key)
>         const char *part_end, *start;
>         int key_len = strlen(key);
>
> +       if (!skiboot_part_hdr)
> +               return NULL;
> +
>         if (!nvram_has_loaded()) {
>                 prlog(PR_WARNING, "NVRAM: Query before is done loading\n");
>                 prlog(PR_WARNING, "NVRAM: Waiting for load\n");
> --
> 2.16.1
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot


More information about the Skiboot mailing list