From acac02d5d27c74c690353f8a62a3e3cad8947b56 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 20 Jun 2017 14:49:04 +0200 Subject: nb/intel/haswell/raminit: Die if cbmem_add() fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Maybe we could go on, but cbmem_add() failing is a very bad sign. Should fix coverity CID 1376384 (Null pointer dereferences (NULL_RETURNS)). Change-Id: I330cee6db3540c6a9c408d56da43105de5d075f7 Found-by: Coverity Scan #1376384 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/20280 Reviewed-by: Patrick Georgi Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Philippe Mathieu-Daudé --- src/northbridge/intel/haswell/raminit.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/northbridge/intel/haswell/raminit.c b/src/northbridge/intel/haswell/raminit.c index 50443aa94c..aa07f16625 100644 --- a/src/northbridge/intel/haswell/raminit.c +++ b/src/northbridge/intel/haswell/raminit.c @@ -187,6 +187,8 @@ void setup_sdram_meminfo(struct pei_data *pei_data) int dimm_cnt = 0; mem_info = cbmem_add(CBMEM_ID_MEMINFO, sizeof(struct memory_info)); + if (!mem_info) + die("Failed to add memory info to CBMEM.\n"); memset(mem_info, 0, sizeof(struct memory_info)); addr_decoder_common = MCHBAR32(0x5000); -- cgit v1.2.3