diff options
author | Subrata Banik <subrata.banik@intel.com> | 2020-09-15 15:16:42 +0530 |
---|---|---|
committer | Subrata Banik <subrata.banik@intel.com> | 2020-09-17 09:56:56 +0000 |
commit | 754de4da375ef5a23efe9656f0eaf4fa496cb9ee (patch) | |
tree | 06db32ffd69ead40c6b473cbcf32aff9f51f9c8b | |
parent | 804b3bd10f13aa864c3898f9f215e662f6af6628 (diff) | |
download | coreboot-754de4da375ef5a23efe9656f0eaf4fa496cb9ee.tar.xz |
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>
-rw-r--r-- | src/soc/intel/common/block/cse/cse_lite.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/soc/intel/common/block/cse/cse_lite.c b/src/soc/intel/common/block/cse/cse_lite.c index edb08dacb2..7daa35eb9b 100644 --- a/src/soc/intel/common/block/cse/cse_lite.c +++ b/src/soc/intel/common/block/cse/cse_lite.c @@ -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); } |