From 9c372773ea28af7803fa479c25196cd7ef1b00698c4543ae91756dd1eec29e53 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 20 Jan 2017 12:21:06 +0000 Subject: [PATCH] - dmidecode-07-only-decode-one-dmi-table.patch: Only decode one DMI table. https://savannah.nongnu.org/bugs/?50022 OBS-URL: https://build.opensuse.org/package/show/Base:System/dmidecode?expand=0&rev=36 --- dmidecode-07-only-decode-one-dmi-table.patch | 68 ++++++++++++++++++++ dmidecode.changes | 7 ++ dmidecode.spec | 4 +- 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 dmidecode-07-only-decode-one-dmi-table.patch diff --git a/dmidecode-07-only-decode-one-dmi-table.patch b/dmidecode-07-only-decode-one-dmi-table.patch new file mode 100644 index 0000000..7a1d6cd --- /dev/null +++ b/dmidecode-07-only-decode-one-dmi-table.patch @@ -0,0 +1,68 @@ +From: Jean Delvare +Date: Fri, 20 Jan 2017 10:57:12 +0100 +Subject: Only decode one DMI table +Git-commit: 12fbde92a26da61eda9f2ff0ba3c316779163f10 +References: https://savannah.nongnu.org/bugs/?50022 + +Since version 3.0.0 of the SMBIOS specification, there can be +multiple entry points in memory, pointing to one or two DMI tables. +If both a 32-bit ("_SM_") entry point and a 64-bit ("_SM3_") entry +point are present, the specification requires that the latter points +to a table which is a super-set of the table pointed to by the +former. Therefore it makes no sense to decode both. + +Per specification, look for a 64-bit ("_SM3_") entry point first, and +if we can't find any, look for a 32-bit ("_SM_" or "_DMI_") entry +point. + +This fixes bug #50022: +https://savannah.nongnu.org/bugs/?50022 +--- + dmidecode.c | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -4903,28 +4903,37 @@ memory_scan: + goto exit_free; + } + +- for (fp = 0; fp <= 0xFFF0; fp += 16) ++ /* Look for a 64-bit entry point first */ ++ for (fp = 0; fp <= 0xFFE0; fp += 16) + { +- if (memcmp(buf + fp, "_SM3_", 5) == 0 && fp <= 0xFFE0) ++ if (memcmp(buf + fp, "_SM3_", 5) == 0) + { + if (smbios3_decode(buf + fp, opt.devmem, 0)) + { + found++; +- fp += 16; ++ goto done; + } + } +- else if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0) ++ } ++ ++ /* If none found, look for a 32-bit entry point */ ++ for (fp = 0; fp <= 0xFFF0; fp += 16) ++ { ++ if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0) + { + if (smbios_decode(buf + fp, opt.devmem, 0)) + { + found++; +- fp += 16; ++ goto done; + } + } + else if (memcmp(buf + fp, "_DMI_", 5) == 0) + { + if (legacy_decode(buf + fp, opt.devmem, 0)) ++ { + found++; ++ goto done; ++ } + } + } + diff --git a/dmidecode.changes b/dmidecode.changes index 75e3867..bacc6f0 100644 --- a/dmidecode.changes +++ b/dmidecode.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jan 20 13:18:38 CET 2017 - jdelvare@suse.de + +- dmidecode-07-only-decode-one-dmi-table.patch: Only decode one + DMI table. + https://savannah.nongnu.org/bugs/?50022 + ------------------------------------------------------------------- Tue May 3 14:10:41 UTC 2016 - jdelvare@suse.de diff --git a/dmidecode.spec b/dmidecode.spec index bbbf12e..1ed5b2c 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -1,7 +1,7 @@ # # spec file for package dmidecode # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -34,6 +34,7 @@ Patch3: dmidecode-03-let-read_file-return-the-actual-data-size.patch Patch4: dmidecode-04-use-read_file-to-read-the-dmi-table-from-sysfs.patch Patch5: dmidecode-05-use-dword-for-structure-table-maximum-size-in-smbios3.patch Patch6: dmidecode-06-hide-irrelevant-fixup-message.patch +Patch7: dmidecode-07-only-decode-one-dmi-table.patch Provides: pmtools:%{_sbindir}/dmidecode Obsoletes: pmtools < 20071117 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -62,6 +63,7 @@ the BIOS told it to. %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 %build make CFLAGS="%{optflags}" %{?_smp_mflags}