public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] firmware: dmi: Don't take garbage into consideration in dmi_smbios3_present()
@ 2022-07-26  9:43 Andy Shevchenko
  2022-07-27  8:25 ` Jean Delvare
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2022-07-26  9:43 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel; +Cc: Jean Delvare

The byte at offset 6 represent length. Don't take it and drop it immediately
by using proper accessor, i.e. get_unaligned_be24().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/firmware/dmi_scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index b2ea318a10a4..24537ce29bc4 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -630,7 +630,7 @@ static int __init dmi_smbios3_present(const u8 *buf)
 {
 	if (memcmp(buf, "_SM3_", 5) == 0 &&
 	    buf[6] < 32 && dmi_checksum(buf, buf[6])) {
-		dmi_ver = get_unaligned_be32(buf + 6) & 0xFFFFFF;
+		dmi_ver = get_unaligned_be24(buf + 7);
 		dmi_num = 0;			/* No longer specified */
 		dmi_len = get_unaligned_le32(buf + 12);
 		dmi_base = get_unaligned_le64(buf + 16);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-30 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26  9:43 [PATCH v1 1/1] firmware: dmi: Don't take garbage into consideration in dmi_smbios3_present() Andy Shevchenko
2022-07-27  8:25 ` Jean Delvare
2022-07-29 18:23   ` Andy Shevchenko
2022-07-30  9:33     ` Jean Delvare
2022-07-30 15:55       ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox