[coreboot-gerrit] Change in coreboot[master]: soc/intel/common/sgx: Fix null pointer dereference warning from klocwork
Pratikkumar V Prajapati (Code Review)
gerrit at coreboot.org
Tue Sep 5 21:32:37 CEST 2017
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 at 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;
--
To view, visit https://review.coreboot.org/21408
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6cc9c68652b074c666c86456183460ca38a886ed
Gerrit-Change-Number: 21408
Gerrit-PatchSet: 1
Gerrit-Owner: Pratikkumar V Prajapati <pratikkumar.v.prajapati at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170905/b3198a5d/attachment-0001.html>
More information about the coreboot-gerrit
mailing list