diff options
author | Tom Rini <trini@konsulko.com> | 2019-09-26 17:22:22 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-09-26 17:22:22 -0400 |
commit | dfd590075ca263d6b3ed22465a94d33a8ee93e07 (patch) | |
tree | ab957060e7ed032b290972984df1e48150c6f7e3 /lib/efi_loader/efi_variable.c | |
parent | 1f3910da6ef6ddb71f02f0ef181a520360380c76 (diff) | |
parent | 3545c6614342e8d91055a0f907ca7441ba00b928 (diff) |
Merge tag 'efi-2019-10-rc5' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for v2019.10-rc5
Bug fixes for the SetVariable() boot service.
Diffstat (limited to 'lib/efi_loader/efi_variable.c')
-rw-r--r-- | lib/efi_loader/efi_variable.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 48ee255f879..4c554c546b2 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -443,8 +443,6 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, if (ret) goto out; -#define ACCESS_ATTR (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS) - old_val = env_get(native_name); if (old_val) { old_val = parse_attr(old_val, &attr); @@ -455,7 +453,9 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, goto out; } - if ((data_size == 0) || !(attributes & ACCESS_ATTR)) { + if ((data_size == 0 && + !(attributes & EFI_VARIABLE_APPEND_WRITE)) || + !attributes) { /* delete the variable: */ env_set(native_name, NULL); ret = EFI_SUCCESS; @@ -470,7 +470,7 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, if (attributes & EFI_VARIABLE_APPEND_WRITE) { if (!prefix(old_val, "(blob)")) { - return EFI_DEVICE_ERROR; + ret = EFI_DEVICE_ERROR; goto out; } old_size = strlen(old_val); @@ -478,8 +478,9 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, old_size = 0; } } else { - if ((data_size == 0) || !(attributes & ACCESS_ATTR) || - (attributes & EFI_VARIABLE_APPEND_WRITE)) { + if ((data_size == 0 && + !(attributes & EFI_VARIABLE_APPEND_WRITE)) || + !attributes) { /* delete, but nothing to do */ ret = EFI_NOT_FOUND; goto out; |