summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Zhao <john.zhao@intel.com>2020-09-22 14:52:42 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-09-28 09:31:28 +0000
commit4792f8f5eb1898b3dc31a4e97744abad8f393e84 (patch)
tree2411a1addf767673c5acde5cb61b70444fee3627 /src
parentd8279fdb6d65b381f019a2be95d926b26863b8f5 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/device/device_util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 22c3db1c44..452a87bf14 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -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);
}