aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/efivars.c
diff options
context:
space:
mode:
authorMike Waychison <mikew@google.com>2011-07-21 16:57:59 -0400
committerTony Luck <tony.luck@intel.com>2011-07-22 19:15:40 -0400
commitc475594d838c5c872e734f693a700df8c01b39d4 (patch)
treead36a818fd7294ecac5eafda9b78ebb67209a1b1 /drivers/firmware/efivars.c
parent828aa1f00ec3508a4d813bd60d210de82929ac97 (diff)
efivars: Use string functions in pstore_write
Instead of open-coding the string operations for comparing the prefix of the variable names, use the provided utf16_* string functions. This patch also changes the calls to efi.set_variable to efivars->ops->set_variable so that the right function gets called in the case of gsmi (which doesn't have a valid efi structure). As well, make sure that we only consider variables with the right vendor string. Signed-off-by: Mike Waychison <mikew@google.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'drivers/firmware/efivars.c')
-rw-r--r--drivers/firmware/efivars.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 15b9a01b6c68..563492e4d5cf 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -512,18 +512,20 @@ static u64 efi_pstore_write(enum pstore_type_id type, unsigned int part,
512 list_for_each_entry(entry, &efivars->list, list) { 512 list_for_each_entry(entry, &efivars->list, list) {
513 get_var_data_locked(efivars, &entry->var); 513 get_var_data_locked(efivars, &entry->var);
514 514
515 for (i = 0; i < DUMP_NAME_LEN; i++) { 515 if (efi_guidcmp(entry->var.VendorGuid, vendor))
516 if (efi_name[i] == 0) { 516 continue;
517 found = entry; 517 if (utf16_strncmp(entry->var.VariableName, efi_name,
518 efivars->ops->set_variable(entry->var.VariableName, 518 utf16_strlen(efi_name)))
519 &entry->var.VendorGuid, 519 continue;
520 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 520 /* Needs to be a prefix */
521 0, NULL); 521 if (entry->var.VariableName[utf16_strlen(efi_name)] == 0)
522 break; 522 continue;
523 } else if (efi_name[i] != entry->var.VariableName[i]) { 523
524 break; 524 /* found */
525 } 525 found = entry;
526 } 526 efivars->ops->set_variable(entry->var.VariableName, &entry->var.VendorGuid,
527 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
528 0, NULL);
527 } 529 }
528 530
529 if (found) 531 if (found)