File dmidecode-only-scan-dev-mem-for-entry-point-on-x86.patch of Package dmidecode.28672

From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 26 Aug 2019 14:20:15 +0200
Subject: dmidecode: Only scan /dev/mem for entry point on x86
Git-commit: e12ec26e19e02281d3e7258c3aabb88a5cf5ec1d
Patch-mainline: 3.3

x86 is the only architecture which can have a DMI entry point scanned
from /dev/mem. Do not attempt it on other architectures, because not
only it can't work, but it can even cause the system to reboot.

This fixes support request #109697:
https://savannah.nongnu.org/support/?109697
---
 dmidecode.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4904,7 +4904,7 @@ int main(int argc, char * const argv[])
 	off_t fp;
 	size_t size;
 	int efi;
-	u8 *buf;
+	u8 *buf = NULL;
 
 	if (sizeof(u8) != 1 || sizeof(u16) != 2 || sizeof(u32) != 4 || '\0' != 0)
 	{
@@ -5000,7 +5000,7 @@ int main(int argc, char * const argv[])
 			printf("Failed to get SMBIOS data from sysfs.\n");
 	}
 
-	/* Next try EFI (ia64, Intel-based Mac) */
+	/* Next try EFI (ia64, Intel-based Mac, arm64) */
 	efi = address_from_efi(&fp);
 	switch (efi)
 	{
@@ -5033,6 +5033,7 @@ int main(int argc, char * const argv[])
 	goto done;
 
 memory_scan:
+#if defined __i386__ || defined __x86_64__
 	if (!(opt.flags & FLAG_QUIET))
 		printf("Scanning %s for entry point.\n", opt.devmem);
 	/* Fallback to memory scan (x86, x86_64) */
@@ -5066,6 +5067,7 @@ memory_scan:
 				found++;
 		}
 	}
+#endif
 
 done:
 	if (!found && !(opt.flags & FLAG_QUIET))
openSUSE Build Service is sponsored by