John Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33152
Change subject: src/soc/intel: Fix Coverity scan report ......................................................................
src/soc/intel: Fix Coverity scan report
Coverity detects pointer mem_info as NULL_RETURNS. Add sanity check for mem_info to prevent null pointer dereference.
BUG=CID 1401394 TEST=Built and boot up to kernel.
Change-Id: I9d78ab38b8b2dd3734e0143acfd88d9093f16ce6 Signed-off-by: John Zhao john.zhao@intel.com --- M src/soc/intel/broadwell/romstage/raminit.c 1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/52/33152/1
diff --git a/src/soc/intel/broadwell/romstage/raminit.c b/src/soc/intel/broadwell/romstage/raminit.c index fc8b7c6..ffa1feb 100644 --- a/src/soc/intel/broadwell/romstage/raminit.c +++ b/src/soc/intel/broadwell/romstage/raminit.c @@ -122,6 +122,10 @@
printk(BIOS_DEBUG, "create cbmem for dimm information\n"); mem_info = cbmem_add(CBMEM_ID_MEMINFO, sizeof(struct memory_info)); + + if (!mem_info) + return; + memset(mem_info, 0, sizeof(*mem_info)); /* Translate pei_memory_info struct data into memory_info struct */ mem_info->dimm_cnt = pei_data->meminfo.dimm_cnt;