John Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/49360 )
Change subject: soc/intel/braswell: Avoid NULL pointer dereference ......................................................................
soc/intel/braswell: Avoid NULL pointer dereference
Coverity detects dereference pointer ps that might be "NULL" when calling cbme_find function. Add sanity check for ps to prevent NULL pointer dereference.
Found-by: Coverity CID 1442304 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I9c3a919d607c2f1a25aef5726dc79f28484d19c0 --- M src/soc/intel/braswell/ramstage.c 1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/49360/1
diff --git a/src/soc/intel/braswell/ramstage.c b/src/soc/intel/braswell/ramstage.c index 7b92c52..b76a890 100644 --- a/src/soc/intel/braswell/ramstage.c +++ b/src/soc/intel/braswell/ramstage.c @@ -125,6 +125,9 @@ struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE); static uint32_t gpe0_sts;
+ if (!ps) + return -1; + *pm1 = ps->pm1_sts & ps->pm1_en;
gpe0_sts = ps->gpe0_sts & ps->gpe0_en;