summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-07-11 20:27:32 +0300
committerTom Rini <trini@konsulko.com>2023-07-11 20:27:32 +0300
commit8e21064cb3452950b09301baec06d86e37342471 (patch)
treea54f8b93191c102403147e44d8fd2fb2c9c9b65f /lib
parent7876a695468c9bc17a6dc02054da101450468a40 (diff)
parente05a4b12a056fd7fe22e85715c8f5e5e811fb551 (diff)
downloadu-boot-8e21064cb3452950b09301baec06d86e37342471.tar.xz
Merge tag 'efi-2023-07-rc7' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2023-07-rc7 Documentation: * Fix links to Linux kernel documentation UEFI: * Fix memory leak in efidebug dh subcommand * Fix underflow when calculating remaining variable store size * Increase default variable store size to 64 KiB * mkeficapsule: fix efi_firmware_management_capsule_header data type
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/Kconfig5
-rw-r--r--lib/efi_loader/efi_var_mem.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index c5835e6ef6..a22e47616f 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -96,7 +96,8 @@ endif
config EFI_VAR_BUF_SIZE
int "Memory size of the UEFI variable store"
- default 16384
+ default 16384 if EFI_MM_COMM_TEE
+ default 65536
range 4096 2147483647
help
This defines the size in bytes of the memory area reserved for keeping
@@ -106,7 +107,7 @@ config EFI_VAR_BUF_SIZE
match the value of PcdFlashNvStorageVariableSize used to compile the
StandAloneMM module.
- Minimum 4096, default 16384.
+ Minimum 4096, default 65536, or 16384 when using StandAloneMM.
config EFI_GET_TIME
bool "GetTime() runtime service"
diff --git a/lib/efi_loader/efi_var_mem.c b/lib/efi_loader/efi_var_mem.c
index d6b65aed12..5fa7dcb8d3 100644
--- a/lib/efi_loader/efi_var_mem.c
+++ b/lib/efi_loader/efi_var_mem.c
@@ -177,6 +177,10 @@ efi_status_t __efi_runtime efi_var_mem_ins(
u64 __efi_runtime efi_var_mem_free(void)
{
+ if (efi_var_buf->length + sizeof(struct efi_var_entry) >=
+ EFI_VAR_BUF_SIZE)
+ return 0;
+
return EFI_VAR_BUF_SIZE - efi_var_buf->length -
sizeof(struct efi_var_entry);
}