From b85ddc787ee2e82712b95b2eb3b90f4b56698e41 Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Mon, 3 Apr 2017 14:02:04 -0400 Subject: util/intelmetool: Check for NULL return from pci_lookup_name pci_lookup_name might return NULL from using format_name internally which could cause a crash when trying to print that value. We check for NULL and print a more appropriate value in that case. Change-Id: I499f0b5e1681f3926df0d8a325aab2c666ebd632 Signed-off-by: Youness Alaoui Reviewed-on: https://review.coreboot.org/19089 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- util/intelmetool/intelmetool.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'util') diff --git a/util/intelmetool/intelmetool.c b/util/intelmetool/intelmetool.c index c49c635ca5..d6fd0fe528 100644 --- a/util/intelmetool/intelmetool.c +++ b/util/intelmetool/intelmetool.c @@ -119,6 +119,8 @@ static int pci_platform_scan() { pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_SIZES | PCI_FILL_CLASS); name = pci_lookup_name(pacc, namebuf, sizeof(namebuf), PCI_LOOKUP_DEVICE, dev->vendor_id, dev->device_id); + if (name == NULL) + name = ""; if (dev->vendor_id == 0x8086) { if (PCI_DEV_HAS_ME_DISABLE(dev->device_id)) { printf(CGRN "Good news, you have a `%s` so ME is present but can be disabled, continuing...\n\n" RESET, name); @@ -242,6 +244,8 @@ static void dump_me_info() { exit(1); } + if (name == NULL) + name = ""; printf("MEI found: [%x:%x] %s\n\n", dev->vendor_id, dev->device_id, name); stat = pci_read_long(dev, 0x40); printf("ME Status : 0x%x\n", stat); -- cgit v1.2.3