aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-09-26 21:40:18 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-10-06 16:02:36 +0200
commit709292a63afc60bc840493315acf18c6c5e27eb4 (patch)
tree81bb46861826f9848f681825decc5c4d2f2f72ce /lib
parentdac51e9aaf6fd38298007b266feb6a80e9ec91ee (diff)
downloadu-boot-709292a63afc60bc840493315acf18c6c5e27eb4.zip
u-boot-709292a63afc60bc840493315acf18c6c5e27eb4.tar.gz
u-boot-709292a63afc60bc840493315acf18c6c5e27eb4.tar.bz2
efi_loader: appending to non-existent variable
Appending to a non-existent variable must result in an error of type EFI_NOT_FOUND. Fixes: 09c76b79a9db ("efi_loader: SetVariable() deleting variables") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_variable.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 4c554c5..d0daf7b 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -478,10 +478,12 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
old_size = 0;
}
} else {
- if ((data_size == 0 &&
- !(attributes & EFI_VARIABLE_APPEND_WRITE)) ||
- !attributes) {
- /* delete, but nothing to do */
+ if (data_size == 0 || !attributes ||
+ (attributes & EFI_VARIABLE_APPEND_WRITE)) {
+ /*
+ * Trying to delete or to update a non-existent
+ * variable.
+ */
ret = EFI_NOT_FOUND;
goto out;
}