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

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