summaryrefslogtreecommitdiff
path: root/util/intelmetool/me.c
diff options
context:
space:
mode:
authorPaul Wise <pabs3@bonedaddy.net>2017-05-04 14:13:38 +0800
committerMartin Roth <martinroth@google.com>2017-05-05 22:40:54 +0200
commite311f94279de87f31b94d47cc46c43f0dd7741ef (patch)
tree292633b1342d978555a5fc6138877a3e6f394258 /util/intelmetool/me.c
parent769f46625be2fe42d98375a72fb4e5a351df511d (diff)
downloadcoreboot-e311f94279de87f31b94d47cc46c43f0dd7741ef.tar.xz
intelmetool: handle failures to mmap MEI memory
Fixes crashes when there is an error mapping memory. Error mapping physical memory 0x0000004275159040 [0x4000] ERRNO=1 Segmentation fault (core dumped) Change-Id: I5becc0c2870dd97297c4e8d1b101b95b31792ca7 Signed-off-by: Paul Wise <pabs3@bonedaddy.net> Reviewed-on: https://review.coreboot.org/19562 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'util/intelmetool/me.c')
-rw-r--r--util/intelmetool/me.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/intelmetool/me.c b/util/intelmetool/me.c
index da5fb71643..8c703a3465 100644
--- a/util/intelmetool/me.c
+++ b/util/intelmetool/me.c
@@ -581,6 +581,10 @@ uint32_t intel_mei_setup(struct pci_dev *dev)
mei_base_address = dev->base_addr[0] & ~0xf;
pagerounded = mei_base_address & ~0xfff;
mei_mmap = map_physical(pagerounded, 0x2000) + mei_base_address - pagerounded;
+ if (mei_mmap == NULL) {
+ printf("Could not map ME setup memory\n");
+ return 1;
+ }
/* Ensure Memory and Bus Master bits are set */
reg32 = pci_read_long(dev, PCI_COMMAND);