All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Check dmi version when get system uuid
@ 2012-07-25 11:04 zhenzhong.duan
  2013-03-15 17:45 ` Anisse Astier
  0 siblings, 1 reply; 2+ messages in thread
From: zhenzhong.duan @ 2012-07-25 11:04 UTC (permalink / raw)
  To: akpm, khali; +Cc: linux-kernel, Feng Jin

As of version 2.6 of the SMBIOS specification, the first 3
fields of the UUID are supposed to be encoded on little-endian.

Also a minor fix to match variable meaning and mute checkpatch.pl

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
---
 drivers/firmware/dmi_scan.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 153980b..d8c804d 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -15,6 +15,7 @@
  */
 static char dmi_empty_string[] = "        ";
 
+static u16  __initdata dmi_ver;
 /*
  * Catch too early calls to dmi_check_system():
  */
@@ -158,8 +159,10 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
 		return;
 
 	for (i = 0; i < 16 && (is_ff || is_00); i++) {
-		if(d[i] != 0x00) is_ff = 0;
-		if(d[i] != 0xFF) is_00 = 0;
+		if (d[i] != 0x00)
+			is_00 = 0;
+		if (d[i] != 0xFF)
+			is_ff = 0;
 	}
 
 	if (is_ff || is_00)
@@ -169,7 +172,16 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
 	if (!s)
 		return;
 
-	sprintf(s, "%pUB", d);
+	/*
+	 * As of version 2.6 of the SMBIOS specification, the first 3
+	 * fields of the UUID are supposed to be encoded on little-endian.
+	 * The specification says that this is the defacto standard,
+	 * update kernel code to match dmidecode data.
+	*/
+	if (dmi_ver >= 0x0206)
+		sprintf(s, "%pUL", d);
+	else
+		sprintf(s, "%pUB", d);
 
         dmi_ident[slot] = s;
 }
@@ -411,6 +423,7 @@ static int __init dmi_present(const char __iomem *p)
 		 * DMI version 0.0 means that the real version is taken from
 		 * the SMBIOS version, which we don't know at this point.
 		 */
+		dmi_ver = (buf[14] & 0xf0) << 4 | (buf[14] & 0x0f);
 		if (buf[14] != 0)
 			printk(KERN_INFO "DMI %d.%d present.\n",
 			       buf[14] >> 4, buf[14] & 0xF);
-- 
1.7.3


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

* Re: [PATCH 1/2] Check dmi version when get system uuid
  2012-07-25 11:04 [PATCH 1/2] Check dmi version when get system uuid zhenzhong.duan
@ 2013-03-15 17:45 ` Anisse Astier
  0 siblings, 0 replies; 2+ messages in thread
From: Anisse Astier @ 2013-03-15 17:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: zhenzhong.duan, akpm, khali, Feng Jin

On Wed, 25 Jul 2012 19:04:57 +0800, "zhenzhong.duan" <zhenzhong.duan@oracle.com> wrote :

> As of version 2.6 of the SMBIOS specification, the first 3
> fields of the UUID are supposed to be encoded on little-endian.
> 
> Also a minor fix to match variable meaning and mute checkpatch.pl
> 

I'm late to the party, as this patch went into 3.8, mimicking a patch
sent in 2011:
https://lkml.org/lkml/2011/1/19/260

Only problem: it breaks the ABI. By changing the value of the DMI UUID
previously sent by the kernel, any application relying on this UUID is
likely to break with 3.8.

I don't know if I should be happy I finally can drop this patch from my 
tree, or sad that a different process let it through.

Regards,

Anisse

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

end of thread, other threads:[~2013-03-15 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 11:04 [PATCH 1/2] Check dmi version when get system uuid zhenzhong.duan
2013-03-15 17:45 ` Anisse Astier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.