Skip to content

Commit 12fbde9

Browse files
committed
Only decode one DMI table
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
1 parent df9ebd5 commit 12fbde9

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2017-01-20 Jean Delvare <jdelvare@suse.de>
2+
3+
* dmidecode.c: Only decode one DMI table.
4+
This fixes Savannah bug #50022:
5+
https://savannah.nongnu.org/bugs/?50022
6+
17
2016-09-22 Jean Delvare <jdelvare@suse.de>
28

39
* README: Explain that we can no longer support Cygwin.

dmidecode.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4925,28 +4925,37 @@ int main(int argc, char * const argv[])
49254925
goto exit_free;
49264926
}
49274927

4928-
for (fp = 0; fp <= 0xFFF0; fp += 16)
4928+
/* Look for a 64-bit entry point first */
4929+
for (fp = 0; fp <= 0xFFE0; fp += 16)
49294930
{
4930-
if (memcmp(buf + fp, "_SM3_", 5) == 0 && fp <= 0xFFE0)
4931+
if (memcmp(buf + fp, "_SM3_", 5) == 0)
49314932
{
49324933
if (smbios3_decode(buf + fp, opt.devmem, 0))
49334934
{
49344935
found++;
4935-
fp += 16;
4936+
goto done;
49364937
}
49374938
}
4938-
else if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0)
4939+
}
4940+
4941+
/* If none found, look for a 32-bit entry point */
4942+
for (fp = 0; fp <= 0xFFF0; fp += 16)
4943+
{
4944+
if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0)
49394945
{
49404946
if (smbios_decode(buf + fp, opt.devmem, 0))
49414947
{
49424948
found++;
4943-
fp += 16;
4949+
goto done;
49444950
}
49454951
}
49464952
else if (memcmp(buf + fp, "_DMI_", 5) == 0)
49474953
{
49484954
if (legacy_decode(buf + fp, opt.devmem, 0))
4955+
{
49494956
found++;
4957+
goto done;
4958+
}
49504959
}
49514960
}
49524961

0 commit comments

Comments
 (0)