John Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45627 )
Change subject: superio/common: Fix NULL pointer dereferences ......................................................................
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 --- M src/superio/common/generic.c 1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/45627/1
diff --git a/src/superio/common/generic.c b/src/superio/common/generic.c index 83f2fea..50db688 100644 --- a/src/superio/common/generic.c +++ b/src/superio/common/generic.c @@ -20,7 +20,8 @@ continue;
res->flags |= IORESOURCE_STORED; - report_resource_stored(dev, res, ""); + if (dev->link_list) + report_resource_stored(dev, res, ""); } }
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45627 )
Change subject: superio/common: Fix NULL pointer dereferences ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/45627/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/45627/1//COMMIT_MSG@11 PS1, Line 11: prevent NULL pointer dereference. Why not add the check inside `report_resource_stored`, then?
Hello build bot (Jenkins), Tim Wawrzynczak, Angel Pons, Felix Held,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/45627
to look at the new patch set (#2).
Change subject: superio/common: Fix NULL pointer dereferences ......................................................................
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 --- M src/device/device_util.c 1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/45627/2
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45627 )
Change subject: superio/common: Fix NULL pointer dereferences ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/45627/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/45627/1//COMMIT_MSG@11 PS1, Line 11: prevent NULL pointer dereference.
Why not add the check inside `report_resource_stored`, then?
Ack
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45627 )
Change subject: superio/common: Fix NULL pointer dereferences ......................................................................
Patch Set 2: Code-Review+1
(1 comment)
https://review.coreboot.org/c/coreboot/+/45627/2/src/device/device_util.c File src/device/device_util.c:
https://review.coreboot.org/c/coreboot/+/45627/2/src/device/device_util.c@52... PS2, Line 525: if (resource->flags & IORESOURCE_PCI_BRIDGE) { I'd place the check here:
if (dev->link_list && (resource->flags & IORESOURCE_PCI_BRIDGE)) {
This way, we still print the other information.
Hello build bot (Jenkins), Tim Wawrzynczak, Angel Pons, Felix Held,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/45627
to look at the new patch set (#3).
Change subject: superio/common: Fix NULL pointer dereferences ......................................................................
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 --- M src/device/device_util.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/45627/3
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45627 )
Change subject: superio/common: Fix NULL pointer dereferences ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/45627/2/src/device/device_util.c File src/device/device_util.c:
https://review.coreboot.org/c/coreboot/+/45627/2/src/device/device_util.c@52... PS2, Line 525: if (resource->flags & IORESOURCE_PCI_BRIDGE) {
I'd place the check here: […]
Ack
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45627 )
Change subject: superio/common: Fix NULL pointer dereferences ......................................................................
Patch Set 3: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/45627 )
Change subject: superio/common: Fix NULL pointer dereferences ......................................................................
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 --- M src/device/device_util.c 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
diff --git a/src/device/device_util.c b/src/device/device_util.c index 22c3db1..452a87b 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -519,7 +519,7 @@ 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); }