4a6338
From b535cf94fca7b3cda4905c26f6b5921e15abbc9f Mon Sep 17 00:00:00 2001
4a6338
From: Jean Delvare <jdelvare@suse.de>
4a6338
Date: Mon, 26 Aug 2019 14:20:15 +0200
4a6338
Subject: [PATCH 05/11] dmidecode: Only scan /dev/mem for entry point on x86
4a6338
4a6338
x86 is the only architecture which can have a DMI entry point scanned
4a6338
from /dev/mem. Do not attempt it on other architectures, because not
4a6338
only it can't work, but it can even cause the system to reboot.
4a6338
4a6338
This fixes support request #109697:
4a6338
https://savannah.nongnu.org/support/?109697
4a6338
4a6338
---
4a6338
 dmidecode.c | 8 +++++---
4a6338
 1 file changed, 5 insertions(+), 3 deletions(-)
4a6338
4a6338
diff --git a/dmidecode.c b/dmidecode.c
4a6338
index 21bfd65274c4..9c1e9c4b0498 100644
4a6338
--- a/dmidecode.c
4a6338
+++ b/dmidecode.c
4a6338
@@ -2,7 +2,7 @@
4a6338
  * DMI Decode
4a6338
  *
4a6338
  *   Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
4a6338
- *   Copyright (C) 2002-2018 Jean Delvare <jdelvare@suse.de>
4a6338
+ *   Copyright (C) 2002-2019 Jean Delvare <jdelvare@suse.de>
4a6338
  *
4a6338
  *   This program is free software; you can redistribute it and/or modify
4a6338
  *   it under the terms of the GNU General Public License as published by
4a6338
@@ -5538,7 +5538,7 @@ int main(int argc, char * const argv[])
4a6338
 	off_t fp;
4a6338
 	size_t size;
4a6338
 	int efi;
4a6338
-	u8 *buf;
4a6338
+	u8 *buf = NULL;
4a6338
 
4a6338
 	/*
4a6338
 	 * We don't want stdout and stderr to be mixed up if both are
4a6338
@@ -5642,7 +5642,7 @@ int main(int argc, char * const argv[])
4a6338
 			printf("Failed to get SMBIOS data from sysfs.\n");
4a6338
 	}
4a6338
 
4a6338
-	/* Next try EFI (ia64, Intel-based Mac) */
4a6338
+	/* Next try EFI (ia64, Intel-based Mac, arm64) */
4a6338
 	efi = address_from_efi(&fp);
4a6338
 	switch (efi)
4a6338
 	{
4a6338
@@ -5675,6 +5675,7 @@ int main(int argc, char * const argv[])
4a6338
 	goto done;
4a6338
 
4a6338
 memory_scan:
4a6338
+#if defined __i386__ || defined __x86_64__
4a6338
 	if (!(opt.flags & FLAG_QUIET))
4a6338
 		printf("Scanning %s for entry point.\n", opt.devmem);
4a6338
 	/* Fallback to memory scan (x86, x86_64) */
4a6338
@@ -5717,6 +5718,7 @@ int main(int argc, char * const argv[])
4a6338
 			}
4a6338
 		}
4a6338
 	}
4a6338
+#endif
4a6338
 
4a6338
 done:
4a6338
 	if (!found && !(opt.flags & FLAG_QUIET))
4a6338
-- 
4a6338
2.17.1
4a6338