summaryrefslogtreecommitdiff
path: root/util/intelmetool
diff options
context:
space:
mode:
authorHuan Truong <htruong@tnhh.net>2017-03-05 02:24:51 -0600
committerMartin Roth <martinroth@google.com>2017-03-08 04:34:34 +0100
commit2a1ae05316db8d70c8e15df4913b786b120ab615 (patch)
tree160432f940c41ef9b8c4b385de19cb3aa6f9314b /util/intelmetool
parent954338d21b5ed2574647eb11c4d7a80931fc6cc7 (diff)
util/intelmetool: Fix segfault on edge cases
The intel ME checker tool would segfault if it reaches the end of the loop without having the dev pointer set. This happens when it gets to the end of the previous loop without knowing what to do with any of the devices it sees. This patch makes sure the pointer is not NULL before accessing it. Change-Id: Ia13191799d7e00185947f9df5188cb2666c43e2a Signed-off-by: Huan Truong <htruong@tnhh.net> Reviewed-on: https://review.coreboot.org/18573 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'util/intelmetool')
-rw-r--r--util/intelmetool/intelmetool.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/intelmetool/intelmetool.c b/util/intelmetool/intelmetool.c
index 70b23fbec2..45e8c8f7ba 100644
--- a/util/intelmetool/intelmetool.c
+++ b/util/intelmetool/intelmetool.c
@@ -137,7 +137,8 @@ static int pci_platform_scan() {
}
}
- if (!PCI_DEV_HAS_ME_DISABLE(dev->device_id) &&
+ if (dev != NULL &&
+ !PCI_DEV_HAS_ME_DISABLE(dev->device_id) &&
!PCI_DEV_HAS_ME_DIFFICULT(dev->device_id) &&
!PCI_DEV_CAN_DISABLE_ME_IF_PRESENT(dev->device_id) &&
!PCI_DEV_ME_NOT_SURE(dev->device_id)) {