[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH] Only decode one DMI table
From: |
Jean Delvare |
Subject: |
[dmidecode] [PATCH] Only decode one DMI table |
Date: |
Mon, 16 Jan 2017 11:09:56 +0100 |
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 fixed bug #50022:
https://savannah.nongnu.org/bugs/?50022
---
dmidecode.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
--- dmidecode.orig/dmidecode.c 2016-09-07 22:17:04.486138537 +0200
+++ dmidecode/dmidecode.c 2017-01-12 17:08:49.231245228 +0100
@@ -4925,28 +4925,35 @@ int main(int argc, char * const argv[])
goto exit_free;
}
- for (fp = 0; fp <= 0xFFF0; fp += 16)
+ 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)
+ }
+
+ 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;
+ }
}
}
--
Jean Delvare
SUSE L3 Support
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dmidecode] [PATCH] Only decode one DMI table,
Jean Delvare <=