diff options
author | John Zhao <john.zhao@intel.com> | 2020-07-17 09:09:56 -0700 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2020-07-24 21:21:09 +0000 |
commit | 9857c906854752848cbe0b68fb0c35e924a3dd28 (patch) | |
tree | cea40ff8783320236e973be79ac74aac8dbbec3a /src/superio | |
parent | 7f107b472a386c8e07bfa736384041ecec561a1d (diff) |
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 <john.zhao@intel.com>
Change-Id: I03efad87ba761e914b47e3294c646335cfbaed24
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43553
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/superio')
-rw-r--r-- | src/superio/common/generic.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); |