lkml.org 
[lkml]   [2013]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] efivarfs: fix abnormal GUID in variable name by using strcpy to replace null with dash
Date
From: Michael Schroeder <mls@suse.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@console-pimps.org>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Jeremy Kerr <jeremy.kerr@canonical.com>
Cc: Michael Schroeder <mls@suse.com>
Reported-by: Frederic Crozat <fcrozat@suse.com>
Tested-by: Frederic Crozat <fcrozat@suse.com>
Signed-off-by: Lee, Chun-Yi <jlee@suse.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


\
 
 \ /
  Last update: 2013-03-01 05:01    [W:0.091 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site