Pratikkumar V Prajapati has uploaded this change for review. ( https://review.coreboot.org/21408
Change subject: soc/intel/common/sgx: Fix null pointer dereference warning from klocwork ......................................................................
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 --- M src/soc/intel/common/block/sgx/sgx.c 1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/08/21408/1
diff --git a/src/soc/intel/common/block/sgx/sgx.c b/src/soc/intel/common/block/sgx/sgx.c index da84ea6..ec1b638 100644 --- a/src/soc/intel/common/block/sgx/sgx.c +++ b/src/soc/intel/common/block/sgx/sgx.c @@ -41,7 +41,13 @@ 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 @@ 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;