soc/intel/common/block: Add NULL check for 'ctx' pointer

Found-by: Klocwork, Avoid NULL pointer (ctx) dereference.

Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Change-Id: I16015b538112e0b125b4a5e145c26263c456953c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45411
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Subrata Banik 2020-09-15 15:16:42 +05:30
parent 804b3bd10f
commit 754de4da37

View file

@ -169,13 +169,14 @@ static void cse_trigger_recovery(uint8_t rec_sub_code)
/* Log CSE Firmware Status Registers to help debugging */
cse_log_status_registers();
if (CONFIG(VBOOT)) {
struct vb2_context *ctx;
ctx = vboot_get_context();
struct vb2_context *ctx = vboot_get_context();
if (ctx == NULL)
goto failure;
vb2api_fail(ctx, VB2_RECOVERY_INTEL_CSE_LITE_SKU, rec_sub_code);
vboot_save_data(ctx);
vboot_reboot();
}
failure:
die("cse_lite: Failed to trigger recovery mode(recovery subcode:%d)\n", rec_sub_code);
}