From 9de3769543bd35b75d8a4c549a23aa61abc3705c Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 20 Feb 2013 10:00:06 -0800
Subject: [PATCH] DMI: Always call dmi_present with DMI structure

If SMBIOS entry point has invalid checksum, smbios_present will call
dmi_present with wrong offset of DMI structure: 0, instead of 16.  We
should always call dmi_present with DMI structure.
---
 drivers/firmware/dmi_scan.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 982f1f5..17073a8 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -442,7 +442,6 @@ static int __init dmi_present(const char __iomem *p)
 static int __init smbios_present(const char __iomem *p)
 {
 	u8 buf[32];
-	int offset = 0;
 
 	memcpy_fromio(buf, p, 32);
 	if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) {
@@ -461,9 +460,9 @@ static int __init smbios_present(const char __iomem *p)
 			dmi_ver = 0x0206;
 			break;
 		}
-		offset = 16;
 	}
-	return dmi_present(buf + offset);
+	/* 16 is the offset of _DMI_ string.  */
+	return dmi_present(buf + 16);
 }
 
 void __init dmi_scan_machine(void)
-- 
1.7.11.7

