soc/intel/common/crashlog: Check cbmem pointer before copying records
Check existence of crashlog records in CBMEM before copying them to BERT, otherwise it can lead to NULL pointer access. Bug=None TEST=Able to build. With Meteor Lake SOC related patch, able to capture and decode crashlog. Change-Id: I4288011866283a3a5fb8ec9e10cd51b794052b4e Signed-off-by: Pratikkumar Prajapati <pratikkumar.v.prajapati@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/75528 Reviewed-by: Subrata Banik <subratabanik@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
5f3b6545f4
commit
385f4bb965
|
@ -488,6 +488,10 @@ bool cl_fill_cpu_records(void *cl_record)
|
|||
|
||||
printk(BIOS_DEBUG, "CPU crash data collection.\n");
|
||||
cl_src_addr = cbmem_find(CBMEM_ID_CPU_CRASHLOG);
|
||||
if (!cl_src_addr) {
|
||||
printk(BIOS_DEBUG, "CPU crash data, CBMEM not found\n");
|
||||
return false;
|
||||
}
|
||||
memcpy(cl_record, cl_src_addr, m_cpu_crashLog_size);
|
||||
|
||||
return true;
|
||||
|
@ -506,6 +510,10 @@ bool cl_fill_pmc_records(void *cl_record)
|
|||
|
||||
printk(BIOS_DEBUG, "PMC crash data collection.\n");
|
||||
cl_src_addr = cbmem_find(CBMEM_ID_PMC_CRASHLOG);
|
||||
if (!cl_src_addr) {
|
||||
printk(BIOS_DEBUG, "PMC crash data, CBMEM not found\n");
|
||||
return false;
|
||||
}
|
||||
memcpy(cl_record, cl_src_addr, m_pmc_crashLog_size);
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue