Blame SOURCES/0005-dmidecode-Only-scan-dev-mem-for-entry-point-on-x86.patch

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