From 58eb6346594c07ee470e94c3b00885d0c734d167 Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Tue, 25 Jul 2017 16:34:26 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/20766 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/intel/skylake/igd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/soc/intel/skylake/igd.c b/src/soc/intel/skylake/igd.c index ea4241c64b..dbcbd4d766 100644 --- a/src/soc/intel/skylake/igd.c +++ b/src/soc/intel/skylake/igd.c @@ -144,7 +144,10 @@ static unsigned long write_acpi_igd_opregion(device_t device, 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);