diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-05-15 19:32:43 +0200 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-05-19 08:10:10 +0200 |
commit | 487d8c75f1d3a1cf084e7fd61955591edc083f80 (patch) | |
tree | 134511777c68e86c94b2c5d2b3c22183437c3611 /lib | |
parent | 98b3156b0df4b0df9cb3a0bbfc240d0c4edd2638 (diff) | |
download | u-boot-487d8c75f1d3a1cf084e7fd61955591edc083f80.tar.gz |
efi_loader: GetVariable set attributes for EFI_BUFFER_TOO_SMALL
UEFI spec 2.7 erratum A leaves it undefined if Attributes should be set if
GetVariable() returns EFI_BUFFER_TOO_SMALL.
UEFI spec 2.8 defines that Attributes should be set if the return value is
either EFI_SUCCESS or EFI_BUFFER_TOO_SMALL.
Set Attributes if the return value is EFI_BUFFER_TOO_SMALL.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efi_loader/efi_variable.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 37728c3c16..28b1aa7505 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -202,8 +202,10 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name, len /= 2; *data_size = len; - if (in_size < len) - return EFI_EXIT(EFI_BUFFER_TOO_SMALL); + if (in_size < len) { + ret = EFI_BUFFER_TOO_SMALL; + goto out; + } if (!data) return EFI_EXIT(EFI_INVALID_PARAMETER); @@ -217,8 +219,10 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name, *data_size = len; - if (in_size < len) - return EFI_EXIT(EFI_BUFFER_TOO_SMALL); + if (in_size < len) { + ret = EFI_BUFFER_TOO_SMALL; + goto out; + } if (!data) return EFI_EXIT(EFI_INVALID_PARAMETER); @@ -232,10 +236,11 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name, return EFI_EXIT(EFI_DEVICE_ERROR); } +out: if (attributes) *attributes = attr & EFI_VARIABLE_MASK; - return EFI_EXIT(EFI_SUCCESS); + return EFI_EXIT(ret); } static char *efi_variables_list; |