diff options
author | Youness Alaoui <kakaroto@kakaroto.homelinux.net> | 2017-04-03 14:02:04 -0400 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2017-04-04 20:48:34 +0200 |
commit | b85ddc787ee2e82712b95b2eb3b90f4b56698e41 (patch) | |
tree | 144b1f4c0669dad0ad38b1091dec908998e11ba9 /util/intelmetool/intelmetool.c | |
parent | cb7d6a19bb4fafaeb52e0ad3b6683dc3ac5e242e (diff) |
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 <youness.alaoui@puri.sm>
Reviewed-on: https://review.coreboot.org/19089
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'util/intelmetool/intelmetool.c')
-rw-r--r-- | util/intelmetool/intelmetool.c | 4 |
1 files changed, 4 insertions, 0 deletions
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 = "<unknown>"; 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 = "<unknown>"; 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); |