[Skiboot] [PATCH 2/4] Assert that memory allocation succeeds in mem_region_add_dt_reserved_node()

Stewart Smith stewart at linux.vnet.ibm.com
Wed Sep 9 15:54:11 AEST 2015


If we fail to allocate memory at this point in boot, we should just
assert, there's really no coming back from not being able to reserve
our reserved memory.

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 core/mem_region.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/core/mem_region.c b/core/mem_region.c
index a742fe4..f6a52a0 100644
--- a/core/mem_region.c
+++ b/core/mem_region.c
@@ -1078,6 +1078,7 @@ static void mem_region_add_dt_reserved_node(struct dt_node *parent,
 	}
 
 	name = strdup(region->name);
+	assert(name);
 
 	/* remove any cell addresses in the region name; we have our own cell
 	 * addresses here */
@@ -1086,6 +1087,7 @@ static void mem_region_add_dt_reserved_node(struct dt_node *parent,
 		*p = '\0';
 
 	region->node = dt_new_addr(parent, name, region->start);
+	assert(region->node);
 	dt_add_property_u64s(region->node, "reg", region->start, region->len);
 	free(name);
 }
-- 
2.1.4



More information about the Skiboot mailing list