diff mbox series

[RFC] nvram: nvram_query do not run if no nvram was found

Message ID 20180216065224.30721-1-npiggin@gmail.com
State Superseded
Headers show
Series [RFC] nvram: nvram_query do not run if no nvram was found | expand

Commit Message

Nicholas Piggin Feb. 16, 2018, 6:52 a.m. UTC
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.
---
 core/nvram-format.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

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");