[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1362108018-13117-1-git-send-email-jlee@suse.com>
Date: Fri, 1 Mar 2013 11:20:18 +0800
From: "Lee, Chun-Yi" <joeyli.kernel@...il.com>
To: matt@...sole-pimps.org
Cc: linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
Michael Schroeder <mls@...e.com>,
Josh Boyer <jwboyer@...hat.com>,
Jeremy Kerr <jeremy.kerr@...onical.com>,
"Lee, Chun-Yi" <jlee@...e.com>
Subject: [PATCH] efivarfs: fix abnormal GUID in variable name by using strcpy to replace null with dash
From: Michael Schroeder <mls@...e.com>
On HP z220 system (firmware version 1.54), some EFI variables are incorrectly
named :
ls -d /sys/firmware/efi/vars/*8be4d* | grep -v -- -8be returns
/sys/firmware/efi/vars/dbxDefault-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
/sys/firmware/efi/vars/KEKDefault-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
/sys/firmware/efi/vars/SecureBoot-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
/sys/firmware/efi/vars/SetupMode-Information8be4df61-93ca-11d2-aa0d-00e098032b8c
That causes by the following statement in efivar_create_sysfs_entry function:
*(short_name + strlen(short_name)) = '-';
efi_guid_unparse(vendor_guid, short_name + strlen(short_name));
The trailing \0 is overwritten with '-', but the next char doesn't seem to be a \0
as well for HP. So, the second strlen return the point of next '\0', causes there
have garbage string attached before GUID.
Tested on On HP z220.
Cc: Matt Fleming <matt@...sole-pimps.org>
Cc: Josh Boyer <jwboyer@...hat.com>
Cc: Jeremy Kerr <jeremy.kerr@...onical.com>
Cc: Michael Schroeder <mls@...e.com>
Reported-by: Frederic Crozat <fcrozat@...e.com>
Tested-by: Frederic Crozat <fcrozat@...e.com>
Signed-off-by: Lee, Chun-Yi <jlee@...e.com>
---
drivers/firmware/efivars.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 8bcb595..fbf18ff 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -1708,7 +1708,7 @@ efivar_create_sysfs_entry(struct efivars *efivars,
/* This is ugly, but necessary to separate one vendor's
private variables from another's. */
- *(short_name + strlen(short_name)) = '-';
+ strcpy(short_name + strlen(short_name), "-");
efi_guid_unparse(vendor_guid, short_name + strlen(short_name));
new_efivar->kobj.kset = efivars->kset;
--
1.6.0.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists