summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_variable.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-02-10 13:45:15 -0500
committerTom Rini <trini@konsulko.com>2023-02-10 13:45:15 -0500
commitc34009d5a9a570355bd9efa0853e408ef8c210f3 (patch)
tree98c945c6e428d0e3e6cf05a951bb649358e51efd /lib/efi_loader/efi_variable.c
parenta1e6b529e57c622e862e93fa6da03d9504565089 (diff)
parent124725732fdfd63ebb2f6514c690181ccbe13444 (diff)
Merge tag 'efi-2023-04-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2023-04-rc2 Documentation: * Provide page with links to talks on U-Boot UEFI: * Enable CTRL+S to save the boot order in eficonfig command * Run attribute check for QueryVariableInfo() only for the file store * Bug fixes Others: * Improve output formatting of the coninfo command # -----END PGP SIGNATURE----- # gpg: Signature made Fri 10 Feb 2023 12:15:45 PM EST # gpg: using RSA key 6DC4F9C71F29A6FA06B76D33C481DBBC2C051AC4 # gpg: Good signature from "Heinrich Schuchardt <xypron.glpk@gmx.de>" [unknown] # gpg: aka "[jpeg image of size 1389]" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6DC4 F9C7 1F29 A6FA 06B7 6D33 C481 DBBC 2C05 1AC4
Diffstat (limited to 'lib/efi_loader/efi_variable.c')
-rw-r--r--lib/efi_loader/efi_variable.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 7c32adf6e5b..4c85cfa607e 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -349,6 +349,29 @@ efi_status_t efi_query_variable_info_int(u32 attributes,
u64 *remaining_variable_storage_size,
u64 *maximum_variable_size)
{
+ if (attributes == 0)
+ return EFI_INVALID_PARAMETER;
+
+ /* EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated */
+ if ((attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) ||
+ ((attributes & EFI_VARIABLE_MASK) == 0))
+ return EFI_UNSUPPORTED;
+
+ if ((attributes & EFI_VARIABLE_MASK) == EFI_VARIABLE_NON_VOLATILE)
+ return EFI_INVALID_PARAMETER;
+
+ /* Make sure if runtime bit is set, boot service bit is set also. */
+ if ((attributes &
+ (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) ==
+ EFI_VARIABLE_RUNTIME_ACCESS)
+ return EFI_INVALID_PARAMETER;
+
+ if (attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD)
+ return EFI_UNSUPPORTED;
+
+ if (attributes & ~(u32)EFI_VARIABLE_MASK)
+ return EFI_INVALID_PARAMETER;
+
*maximum_variable_storage_size = EFI_VAR_BUF_SIZE -
sizeof(struct efi_var_file);
*remaining_variable_storage_size = efi_var_mem_free();
@@ -372,7 +395,7 @@ efi_status_t efi_query_variable_info_int(u32 attributes,
* selected type
* Returns: status code
*/
-efi_status_t __efi_runtime EFIAPI efi_query_variable_info_runtime(
+static efi_status_t __efi_runtime EFIAPI efi_query_variable_info_runtime(
u32 attributes,
u64 *maximum_variable_storage_size,
u64 *remaining_variable_storage_size,