summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/nvedit_efi.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 3a36f94775b..f38802e4f4d 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -448,13 +448,14 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
var_name = argv[0];
- if (default_guid) {
- if (!strcmp(var_name, "db") || !strcmp(var_name, "dbx") ||
- !strcmp(var_name, "dbt"))
- guid = efi_guid_image_security_database;
- else
- guid = efi_global_variable_guid;
+ var_name16 = efi_convert_string(var_name);
+ if (!var_name16) {
+ printf("## Out of memory\n");
+ ret = CMD_RET_FAILURE;
+ goto out;
}
+ if (default_guid)
+ guid = *efi_auth_var_get_guid(var_name16);
if (verbose) {
printf("GUID: %pUl (%pUs)\n", &guid, &guid);
@@ -479,16 +480,8 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
16, 1, value, size, true);
}
- var_name16 = efi_convert_string(var_name);
- if (!var_name16) {
- printf("## Out of memory\n");
- ret = CMD_RET_FAILURE;
- goto out;
- }
ret = efi_set_variable_int(var_name16, &guid, attributes, size, value,
true);
- free(var_name16);
- unmap_sysmem(value);
if (ret == EFI_SUCCESS) {
ret = CMD_RET_SUCCESS;
} else {
@@ -518,6 +511,7 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
ret = CMD_RET_FAILURE;
}
out:
+ free(var_name16);
if (value_on_memory)
unmap_sysmem(value);
else