summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_variable.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-05-25 11:34:40 -0400
committerTom Rini <trini@konsulko.com>2019-05-25 11:34:40 -0400
commit85e1900d9935b2b9fe02e0b3faba75e1695af172 (patch)
tree80561b053dd0b56328ccc37872c3235a42cff313 /lib/efi_loader/efi_variable.c
parent56730706cc6842e852fb6d2c6fd90d07786c2ecf (diff)
parenta2c6983740104c8e608c411eff6a58e2f4feaede (diff)
Merge tag 'efi-2019-07-rc3-3' of git://git.denx.de/u-boot-efi
Pull request for UEFI sub-system for v2019.07-rc3 (3) Several bug fixes for the UEFI sub-system are provided. The SetTime() boottime service is implemented.
Diffstat (limited to 'lib/efi_loader/efi_variable.c')
-rw-r--r--lib/efi_loader/efi_variable.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 28b1aa7505a..50bc10537f4 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -427,7 +427,9 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
EFI_ENTRY("\"%ls\" %pUl %x %zu %p", variable_name, vendor, attributes,
data_size, data);
- if (!variable_name || !vendor) {
+ /* TODO: implement APPEND_WRITE */
+ if (!variable_name || !vendor ||
+ (attributes & EFI_VARIABLE_APPEND_WRITE)) {
ret = EFI_INVALID_PARAMETER;
goto out;
}
@@ -449,12 +451,21 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
if (val) {
parse_attr(val, &attr);
+ /* We should not free val */
+ val = NULL;
if (attr & READ_ONLY) {
- /* We should not free val */
- val = NULL;
ret = EFI_WRITE_PROTECTED;
goto out;
}
+
+ /*
+ * attributes won't be changed
+ * TODO: take care of APPEND_WRITE once supported
+ */
+ if (attr != attributes) {
+ ret = EFI_INVALID_PARAMETER;
+ goto out;
+ }
}
val = malloc(2 * data_size + strlen("{ro,run,boot}(blob)") + 1);