John Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42839 )
Change subject: superio/nuvoton: Avoid NULL pointer dereference ......................................................................
superio/nuvoton: Avoid NULL pointer dereference
Coverity detects dereferencing a pointer that might be "NULL" when calling acpigen_write_scope. Add sanity check for scope to prevent NULL pointer dereference.
Found-by: Coverity CID 1420207
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: Icc253c63aadef1c0ecb116a38b608f64f80abc79 --- M src/superio/nuvoton/npcd378/superio.c 1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/39/42839/1
diff --git a/src/superio/nuvoton/npcd378/superio.c b/src/superio/nuvoton/npcd378/superio.c index 628bd4e..46923e0 100644 --- a/src/superio/nuvoton/npcd378/superio.c +++ b/src/superio/nuvoton/npcd378/superio.c @@ -325,7 +325,8 @@ acpigen_pop_len(); /* Pop Scope */
/* Inject into parent: */ - acpigen_write_scope(acpi_device_scope(dev)); + if (scope) + acpigen_write_scope(scope);
acpigen_write_name_integer("MSFG", 1); acpigen_write_name_integer("KBFG", 1);