Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/23760
Change subject: drivers/generic/adau7002/adau7002.c: Fix null pointer dereference ......................................................................
drivers/generic/adau7002/adau7002.c: Fix null pointer dereference
Procedures acpi_device_scope() and acpi_device_name() can under certain conditions return NULL. Check the return before using them.
This fixes CID 1385944 BUG=b:73331544 TEST=Build kahlee.
Change-Id: Ifcdf905100d22a1d828394f8685641eb432bb836 Signed-off-by: Richard Spiegel richard.spiegel@silverbackltd.com --- M src/drivers/generic/adau7002/adau7002.c 1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/23760/1
diff --git a/src/drivers/generic/adau7002/adau7002.c b/src/drivers/generic/adau7002/adau7002.c index d21d513..1e1acf0 100644 --- a/src/drivers/generic/adau7002/adau7002.c +++ b/src/drivers/generic/adau7002/adau7002.c @@ -32,9 +32,14 @@ if (!dev->enabled) return;
+ const char *scope = acpi_device_scope(dev); + const char *name = acpi_device_name(dev); + if (!scope || !name) + return; + /* Device */ - acpigen_write_scope(acpi_device_scope(dev)); - acpigen_write_device(acpi_device_name(dev)); + acpigen_write_scope(scope); + acpigen_write_device(name); acpigen_write_name_string("_HID", ADAU7002_ACPI_HID); acpigen_write_name_integer("_UID", 0); acpigen_write_name_string("_DDN", dev->chip_ops->name);