From 4519277ca2e11ed728754efbe13e1a444c479da3 Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Sat, 1 Feb 2020 13:04:11 -0700 Subject: drivers/generic/gfx: Add null pointer error check acpi_device_scope() will return NULL if it is unable to find the path of the parent device. Return early if this is the case to prevent a null pointer dereference. Change-Id: I3eff1c1e3477c75c7130b52898de7d59692ba412 Signed-off-by: Jacob Garber Found-by: Coverity CID 1409672 Reviewed-on: https://review.coreboot.org/c/coreboot/+/38669 Reviewed-by: David Hendricks Reviewed-by: HAOUAS Elyes Tested-by: build bot (Jenkins) --- src/drivers/generic/gfx/gfx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/drivers/generic/gfx/gfx.c b/src/drivers/generic/gfx/gfx.c index b2bda4a43c..0386e9b2ef 100644 --- a/src/drivers/generic/gfx/gfx.c +++ b/src/drivers/generic/gfx/gfx.c @@ -69,6 +69,9 @@ static void gfx_fill_ssdt_generator(struct device *dev) const char *scope = acpi_device_scope(dev); + if (!scope) + return; + acpigen_write_scope(scope); /* Method (_DOD, 0) */ -- cgit v1.2.3