From: Michael Schroeder <[email protected]>

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 <[email protected]>
Cc: Josh Boyer <[email protected]>
Cc: Jeremy Kerr <[email protected]>
Cc: Michael Schroeder <[email protected]>
Reported-by: Frederic Crozat <[email protected]>
Tested-by: Frederic Crozat <[email protected]>
Signed-off-by: Lee, Chun-Yi <[email protected]>
---
 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to