[coreboot-gerrit] Change in coreboot[master]: soc/intel/skylake/igd.c: check return value of init_igd_opregion

Martin Kepplinger (Code Review) gerrit at coreboot.org
Tue Jul 25 16:50:32 CEST 2017


Martin Kepplinger has uploaded this change for review. ( https://review.coreboot.org/20766


Change subject: soc/intel/skylake/igd.c: check return value of init_igd_opregion
......................................................................

soc/intel/skylake/igd.c: check return value of init_igd_opregion

init_igd_opregion itself is supposed to return cb_err so this adds
error handling, just like other implentations of write_acpi_tables do it.

this had been found by coverity:

*** CID 1378270:  Error handling issues  (CHECKED_RETURN)
/src/soc/intel/skylake/igd.c: 147 in write_acpi_igd_opregion()
141     	/* If IGD is disabled, exit here */
142     	if (pci_read_config16(device, PCI_VENDOR_ID) == 0xFFFF)
143     		return current;
144
145     	printk(BIOS_DEBUG, "ACPI: * IGD OpRegion\n");
146     	opregion = (igd_opregion_t *)current;

CID 1378270:  Error handling issues  (CHECKED_RETURN)
Calling "init_igd_opregion" without checking return value
(as is done elsewhere 5 out of 6 times).

147     	init_igd_opregion(opregion);
148     	update_igd_opregion(opregion);
149     	current += sizeof(igd_opregion_t);
150     	current = acpi_align_current(current);

TEST=Built

Change-Id: If6f5d53037f093607d89cfe8faf193d55de7f6c4
Found-by: Coverity (CID 1378270:  Error handling issues  (CHECKED_RETURN))
Signed-off-by: Martin Kepplinger <martink at posteo.de>
---
M src/soc/intel/skylake/igd.c
1 file changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/66/20766/1

diff --git a/src/soc/intel/skylake/igd.c b/src/soc/intel/skylake/igd.c
index 0974f1f..d37e8e2 100644
--- a/src/soc/intel/skylake/igd.c
+++ b/src/soc/intel/skylake/igd.c
@@ -144,7 +144,10 @@
 
 	printk(BIOS_DEBUG, "ACPI: * IGD OpRegion\n");
 	opregion = (igd_opregion_t *)current;
-	init_igd_opregion(opregion);
+
+	if (init_igd_opregion(opregion) != CB_SUCCESS)
+		return current;
+
 	update_igd_opregion(opregion);
 	current += sizeof(igd_opregion_t);
 	current = acpi_align_current(current);

-- 
To view, visit https://review.coreboot.org/20766
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If6f5d53037f093607d89cfe8faf193d55de7f6c4
Gerrit-Change-Number: 20766
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Kepplinger <martink at posteo.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170725/1b87b82e/attachment.html>


More information about the coreboot-gerrit mailing list