From 9857c906854752848cbe0b68fb0c35e924a3dd28 Mon Sep 17 00:00:00 2001 From: John Zhao Date: Fri, 17 Jul 2020 09:09:56 -0700 Subject: superio/common: Avoid NULL pointer dereference Coverity detects dereferencing a pointer that might be "NULL" when calling report_resource_stored. Add sanity check for dev to prevent NULL pointer dereference. Found-by: Coverity CID 1419488 Signed-off-by: John Zhao Change-Id: I03efad87ba761e914b47e3294c646335cfbaed24 Reviewed-on: https://review.coreboot.org/c/coreboot/+/43553 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held Reviewed-by: Tim Wawrzynczak Reviewed-by: Angel Pons --- src/superio/common/generic.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/superio/common') diff --git a/src/superio/common/generic.c b/src/superio/common/generic.c index 096b96d376..83f2fea2b2 100644 --- a/src/superio/common/generic.c +++ b/src/superio/common/generic.c @@ -9,6 +9,9 @@ static void generic_set_resources(struct device *dev) { struct resource *res; + if (!dev) + return; + if (dev->link_list) assign_resources(dev->link_list); -- cgit v1.2.3