superio/common: Fix NULL pointer dereferences

Coverity detects the dev->link_list NULL pointer dereferences while
calling report_resource_stored. Add sanity check for dev->link_list to
prevent NULL pointer dereference.

Found-by: Coverity CID 1419488
TEST=None

Signed-off-by: John Zhao <john.zhao@intel.com>
Change-Id: I953a6524fff509a7833896392b25a3245c8cd705
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45627
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
John Zhao 2020-09-22 14:52:42 -07:00 committed by Patrick Georgi
parent d8279fdb6d
commit 4792f8f5eb
1 changed files with 1 additions and 1 deletions

View File

@ -519,7 +519,7 @@ void report_resource_stored(struct device *dev, struct resource *resource,
end = resource_end(resource);
buf[0] = '\0';
if (resource->flags & IORESOURCE_PCI_BRIDGE) {
if (dev->link_list && (resource->flags & IORESOURCE_PCI_BRIDGE)) {
snprintf(buf, sizeof(buf),
"bus %02x ", dev->link_list->secondary);
}