From 5a6fa8e00612c1c8e02cf5279d944c07a0f005c7 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Tue, 4 Jul 2017 15:12:24 +1000 Subject: core/mem_region: check return value of add_region The only sensible thing to do if this fails is to abort() as we've likely just failed reserving reserved memory regions, and nothing good comes from that. Found by static analysis Signed-off-by: Stewart Smith --- core/mem_region.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/mem_region.c b/core/mem_region.c index 8d1363f..77324d7 100644 --- a/core/mem_region.c +++ b/core/mem_region.c @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2017 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -947,7 +947,10 @@ static void mem_region_parse_reserved_properties(void) dt_get_number(range, 2), dt_get_number(range + 1, 2), NULL, REGION_FW_RESERVED); - add_region(region); + if (!add_region(region)) { + prerror("Couldn't add mem_region %s\n", name); + abort(); + } } } else if (names || ranges) { prerror("Invalid properties: reserved-names=%p " -- cgit v1.1