[coreboot-gerrit] Change in coreboot[master]: intel/common/block: Fix issue found by klockwork

John Zhao (Code Review) gerrit at coreboot.org
Tue Oct 16 19:54:37 CEST 2018


John Zhao has uploaded this change for review. ( https://review.coreboot.org/29149


Change subject: intel/common/block: Fix issue found by klockwork
......................................................................

intel/common/block: Fix issue found by klockwork

src/soc/intel/common/block/pmc/pmclib.c
  Function acpi_get_sleep_type: Pointer ps checked for
  NULL may be dereferenced.

BRANCH=None
TEST=Built & booted Yorp board.

Change-Id: I15fe39fd9f930be56d03c2ffe62fb6f17249d4b5
Signed-off-by: John Zhao <john.zhao at intel.com>
---
M src/soc/intel/common/block/pmc/pmclib.c
1 file changed, 5 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/29149/1

diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c
index cfe8011..ef4384d 100644
--- a/src/soc/intel/common/block/pmc/pmclib.c
+++ b/src/soc/intel/common/block/pmc/pmclib.c
@@ -95,9 +95,13 @@
 int acpi_get_sleep_type(void)
 {
 	struct chipset_power_state *ps;
+	int prev_sleep_state = ACPI_S0;
 
 	ps = pmc_get_power_state();
-	return ps->prev_sleep_state;
+	if (ps)
+		prev_sleep_state = ps->prev_sleep_state;
+
+	return prev_sleep_state;
 }
 
 static uint32_t pmc_reset_smi_status(void)

-- 
To view, visit https://review.coreboot.org/29149
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I15fe39fd9f930be56d03c2ffe62fb6f17249d4b5
Gerrit-Change-Number: 29149
Gerrit-PatchSet: 1
Gerrit-Owner: John Zhao <john.zhao at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181016/8c7bb002/attachment-0001.html>


More information about the coreboot-gerrit mailing list