Date: Tue, 8 Apr 2025 13:40:53 GMT From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 8c9b142b3832 - stable/14 - smbios: Apply the v2.1's length fixup only on a 32-bit entry point Message-ID: <202504081340.538Derq4032131@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=8c9b142b38326ef0e4a791564d5c95fb6c5f1da9 commit 8c9b142b38326ef0e4a791564d5c95fb6c5f1da9 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2025-03-03 09:16:14 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2025-04-08 13:38:24 +0000 smbios: Apply the v2.1's length fixup only on a 32-bit entry point Only allow the length tolerance (0x1e instead of 0x1f) for a 32-bit entry point, as there was no 64-bit entry point in the erroneous SMBIOS v2.1 standard and assigning the length with 0x1f does not make sense in this case. While here, fix accessing the major/minor versions via 'eps' even in the 64-bit entry point case (not causing any practical problem thus far as the entry point length is greater than any SMBIOS revisions in existence, so the comparison guarding the fixup would not pass). MFC after: 2 weeks Sponsored by: The FreeBSD Foundation (cherry picked from commit f6cbd6b6d2ccd672e4807128ce0d07db333d4335) --- sys/dev/smbios/smbios.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/dev/smbios/smbios.c b/sys/dev/smbios/smbios.c index f87d2cfee403..f2c1dffad033 100644 --- a/sys/dev/smbios/smbios.c +++ b/sys/dev/smbios/smbios.c @@ -142,14 +142,13 @@ smbios_identify (driver_t *driver, device_t parent) } } if (length != map_size) { - u_int8_t major, minor; - - major = eps->major_version; - minor = eps->minor_version; - - /* SMBIOS v2.1 implementation might use 0x1e. */ - if (length == 0x1e && major == 2 && minor == 1) - length = 0x1f; + /* + * SMBIOS v2.1 implementations might use 0x1e because the + * standard was then erroneous. + */ + if (length == 0x1e && map_size == sizeof(*eps) && + eps->major_version == 2 && eps->minor_version == 1) + length = map_size; else goto unmap_return; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504081340.538Derq4032131>