diff options
author | Pratik Prajapati <pratikkumar.v.prajapati@intel.com> | 2017-09-05 12:27:33 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2017-09-07 20:05:13 +0000 |
commit | 6dc148a42b9ae719521caff43556d60cf8ef7ca6 (patch) | |
tree | b22384efec5f742e35903fb22b9ef0169d91813c /src/soc | |
parent | 2be64048c1cc775c49d9179501e9c51dd307ba72 (diff) |
soc/intel/common/sgx: Fix null pointer dereference warning from klocwork
Fix the warnings of klocwork scan.
e.g. "Pointer 'dev' checked for NULL at line 158 will be dereferenced at line 159"
Change-Id: I6cc9c68652b074c666c86456183460ca38a886ed
Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati@intel.com>
Reviewed-on: https://review.coreboot.org/21408
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/intel/common/block/sgx/sgx.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/sgx/sgx.c b/src/soc/intel/common/block/sgx/sgx.c index da84ea6119..ec1b6386df 100644 --- a/src/soc/intel/common/block/sgx/sgx.c +++ b/src/soc/intel/common/block/sgx/sgx.c @@ -41,8 +41,14 @@ void prmrr_core_configure(void) msr_t prmrr_mask; msr_t msr; device_t dev = SA_DEV_ROOT; + assert(dev != NULL); config_t *conf = dev->chip_info; + if (!conf) { + printk(BIOS_ERR, "SGX: failed to get chip_info\n"); + return; + } + if (!conf->sgx_enable || !is_sgx_supported()) return; @@ -159,6 +165,11 @@ void sgx_configure(void) config_t *conf = dev->chip_info; const void *microcode_patch = intel_mp_current_microcode(); + if (!conf) { + printk(BIOS_ERR, "SGX: failed to get chip_info\n"); + return; + } + if (!conf->sgx_enable || !is_sgx_supported() || !is_prmrr_set()) { printk(BIOS_ERR, "SGX: pre-conditions not met\n"); return; |