From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 13 Apr 2015 17:22:30 +0000 (-0700)
Subject: Merge branch 'core-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git... 
X-Git-Tag: v4.1-rc1~187
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9c65e12a55fea2da50f4069ec0dc47c50b7bd2bb;p=linux-platform-drivers-x86.git

Merge branch 'core-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull EFI update from Ingo Molnar:
 "This tree includes various fixes, cleanups, a new efi=debug boot
  option and EFI boot stub memory allocation optimizations"

* 'core-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  efi/libstub: Retrieve FDT size when loaded from UEFI config table
  efi: Clean up the efi_call_phys_[prolog|epilog]() save/restore interaction
  efi: Disable interrupts around EFI calls, not in the epilog/prolog calls
  x86/efi: Add a "debug" option to the efi= cmdline
  firmware: dmi_scan: Use direct access to static vars
  firmware: dmi_scan: Use full dmi version for SMBIOS3
---

9c65e12a55fea2da50f4069ec0dc47c50b7bd2bb
diff --cc drivers/firmware/dmi_scan.c
index 2eebd28b4c40,c9cb725520c5..6e45a43ffe84
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@@ -86,13 -88,11 +88,13 @@@ static void dmi_table(u8 *buf
  	int i = 0;
  
  	/*
 -	 *	Stop when we see all the items the table claimed to have
 -	 *	OR we run off the end of the table (also happens)
 +	 * Stop when we have seen all the items the table claimed to have
 +	 * (SMBIOS < 3.0 only) OR we reach an end-of-table marker OR we run
 +	 * off the end of the table (should never happen but sometimes does
 +	 * on bogus implementations.)
  	 */
- 	while ((!num || i < num) &&
- 	       (data - buf + sizeof(struct dmi_header)) <= len) {
 -	while ((i < dmi_num) && (data - buf + sizeof(struct dmi_header))
 -		<= dmi_len) {
++	while ((!dmi_num || i < dmi_num) &&
++	       (data - buf + sizeof(struct dmi_header)) <= dmi_len) {
  		const struct dmi_header *dm = (const struct dmi_header *)data;
  
  		/*
@@@ -531,14 -531,27 +533,16 @@@ static int __init dmi_smbios3_present(c
  {
  	if (memcmp(buf, "_SM3_", 5) == 0 &&
  	    buf[6] < 32 && dmi_checksum(buf, buf[6])) {
- 		dmi_ver = get_unaligned_be16(buf + 7);
+ 		dmi_ver = get_unaligned_be32(buf + 6);
+ 		dmi_ver &= 0xFFFFFF;
 +		dmi_num = 0;			/* No longer specified */
  		dmi_len = get_unaligned_le32(buf + 12);
  		dmi_base = get_unaligned_le64(buf + 16);
  
 -		/*
 -		 * The 64-bit SMBIOS 3.0 entry point no longer has a field
 -		 * containing the number of structures present in the table.
 -		 * Instead, it defines the table size as a maximum size, and
 -		 * relies on the end-of-table structure type (#127) to be used
 -		 * to signal the end of the table.
 -		 * So let's define dmi_num as an upper bound as well: each
 -		 * structure has a 4 byte header, so dmi_len / 4 is an upper
 -		 * bound for the number of structures in the table.
 -		 */
 -		dmi_num = dmi_len / 4;
 -
  		if (dmi_walk_early(dmi_decode) == 0) {
- 			pr_info("SMBIOS %d.%d present.\n",
- 				dmi_ver >> 8, dmi_ver & 0xFF);
+ 			pr_info("SMBIOS %d.%d.%d present.\n",
+ 				dmi_ver >> 16, (dmi_ver >> 8) & 0xFF,
+ 				dmi_ver & 0xFF);
  			dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string));
  			pr_debug("DMI: %s\n", dmi_ids_string);
  			return 0;