UPSTREAM: 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.
BUG=none
BRANCH=none
TEST=none
Change-Id: I4dcf7aafb583473e1e6e5a9d2a3192743678fcb0
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: b85ddc787e
Original-Change-Id: I499f0b5e1681f3926df0d8a325aab2c666ebd632
Original-Signed-off-by: Youness Alaoui <youness.alaoui@puri.sm>
Original-Reviewed-on: https://review.coreboot.org/19089
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://chromium-review.googlesource.com/468733
This commit is contained in:
parent
60ec2ddeeb
commit
5fcd074ca2
1 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue