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

Nicholas Piggin npiggin at gmail.com
Sun Mar 25 11:48:17 AEDT 2018


If nvram_check fails, leaving skiboot_part_hdr == NULL, do not
have nvram_query proceed using that pointer, just return NULL.
mambo can run into this.

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



More information about the Skiboot mailing list