From a1c3dcca81cec2755c64b97305a045382b74d2aa Mon Sep 17 00:00:00 2001 From: Nicholas Piggin Date: Mon, 26 Mar 2018 15:02:44 +1000 Subject: nvram: run nvram_validate() after nvram_reformat() nvram_reformat() sets nvram_valid = true, but it does not set skiboot_part_hdr. Call nvram_validate() instead, which sets everything up properly. Reviewed-by: Oliver O'Halloran Signed-off-by: Nicholas Piggin Signed-off-by: Stewart Smith --- core/nvram-format.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/nvram-format.c') diff --git a/core/nvram-format.c b/core/nvram-format.c index 3d030a3..42c5cbb 100644 --- a/core/nvram-format.c +++ b/core/nvram-format.c @@ -180,6 +180,7 @@ int nvram_check(void *nvram_image, const uint32_t nvram_size) } prlog(PR_INFO, "NVRAM: Layout appears sane\n"); + assert(skiboot_part_hdr); return 0; failed: return -1; @@ -234,6 +235,8 @@ const char *nvram_query(const char *key) if (!nvram_validate()) return NULL; + assert(skiboot_part_hdr); + part_end = (const char *) skiboot_part_hdr + be16_to_cpu(skiboot_part_hdr->len) * 16 - 1; -- cgit v1.1