summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShaunak Saha <shaunak.saha@intel.com>2017-12-12 10:21:50 -0800
committerMartin Roth <martinroth@google.com>2018-01-12 18:22:02 +0000
commit5a44176047595120c42e9971b718d9f78110ef1b (patch)
tree4e333b0653fb8a05b59bc97d0026ffbd80bcb147 /src
parente1a75d4a94e32f72a5e99410cdaafef0431cfc8f (diff)
soc/intel/common/block: Check for NULL before dereference
We check for NULL from the return of function acpi_device_path before passing it to acpigen_write_scope to avoid NULL pointer dereference. Change-Id: I997461c9b639acc3c323263d304333d3a894267c Found-by: Klockworks Signed-off-by: Shaunak Saha <shaunak.saha@intel.com> Reviewed-on: https://review.coreboot.org/23094 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/common/block/i2c/i2c.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/soc/intel/common/block/i2c/i2c.c b/src/soc/intel/common/block/i2c/i2c.c
index 7200771a5a..f2154da3f6 100644
--- a/src/soc/intel/common/block/i2c/i2c.c
+++ b/src/soc/intel/common/block/i2c/i2c.c
@@ -122,6 +122,7 @@ static void lpss_i2c_acpi_fill_ssdt(struct device *dev)
I2C_SPEED_HIGH,
};
int i, bus;
+ const char *path;
if (!dev->enabled)
return;
@@ -140,7 +141,11 @@ static void lpss_i2c_acpi_fill_ssdt(struct device *dev)
if (!dw_i2c_addr)
return;
- acpigen_write_scope(acpi_device_path(dev));
+ path = acpi_device_path(dev);
+ if (!path)
+ return;
+
+ acpigen_write_scope(path);
/* Report timing values for the OS driver */
for (i = 0; i < DW_I2C_SPEED_CONFIG_COUNT; i++) {