From e953ace394e1d42d34fde28400479d9ed54026e2 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 26 Aug 2019 14:20:15 +0200 Subject: [PATCH] dmidecode: Only scan /dev/mem for entry point on x86 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dmidecode.c b/dmidecode.c index f41c85b..9f36130 100644 --- a/dmidecode.c +++ b/dmidecode.c @@ -2,7 +2,7 @@ * DMI Decode * * Copyright (C) 2000-2002 Alan Cox - * Copyright (C) 2002-2015 Jean Delvare + * Copyright (C) 2002-2019 Jean Delvare * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -4749,7 +4749,7 @@ int main(int argc, char * const argv[]) int found = 0; off_t fp; int efi; - u8 *buf; + u8 *buf = NULL; if (sizeof(u8) != 1 || sizeof(u16) != 2 || sizeof(u32) != 4 || '\0' != 0) { @@ -4844,7 +4844,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) { @@ -4869,6 +4869,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) */ @@ -4902,6 +4903,7 @@ memory_scan: found++; } } +#endif done: if (!found && !(opt.flags & FLAG_QUIET)) -- 2.17.1