summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-05-15 01:19:26 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2024-05-15 01:19:26 +0300
commit1b10b390d945a19747d75b34a6e01035ac7b9155 (patch)
tree71f972f6930f7e1817b566783a763d7264d96dbc /fs
parent614da38e2f7afe9e01c6e359dfa09285f26fa381 (diff)
parent4b2543f7e1e6b91cfc8dd1696e3cdf01c3ac8974 (diff)
downloadlinux-1b10b390d945a19747d75b34a6e01035ac7b9155.tar.xz
Merge tag 'efi-next-for-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi
Pull EFI updates from Ard Biesheuvel: "Only a handful of changes this cycle, consisting of cleanup work and a low-prio bugfix: - Additional cleanup by Tim for the efivarfs variable name length confusion - Avoid freeing a bogus pointer when virtual remapping is omitted in the EFI boot stub" * tag 'efi-next-for-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi: efi: libstub: only free priv.runtime_map when allocated efi: Clear up misconceptions about a maximum variable name size efivarfs: Remove unused internal struct members Documentation: Mark the 'efivars' sysfs interface as removed efi: pstore: Request at most 512 bytes for variable names
Diffstat (limited to 'fs')
-rw-r--r--fs/efivarfs/internal.h5
-rw-r--r--fs/efivarfs/vars.c5
2 files changed, 4 insertions, 6 deletions
diff --git a/fs/efivarfs/internal.h b/fs/efivarfs/internal.h
index f7206158ee81..d71d2e08422f 100644
--- a/fs/efivarfs/internal.h
+++ b/fs/efivarfs/internal.h
@@ -24,11 +24,8 @@ struct efivarfs_fs_info {
struct efi_variable {
efi_char16_t VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)];
efi_guid_t VendorGuid;
- unsigned long DataSize;
- __u8 Data[1024];
- efi_status_t Status;
__u32 Attributes;
-} __attribute__((packed));
+};
struct efivar_entry {
struct efi_variable var;
diff --git a/fs/efivarfs/vars.c b/fs/efivarfs/vars.c
index 4d722af1014f..3cc89bb624f0 100644
--- a/fs/efivarfs/vars.c
+++ b/fs/efivarfs/vars.c
@@ -295,9 +295,9 @@ static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor,
unsigned long strsize1, strsize2;
bool found = false;
- strsize1 = ucs2_strsize(variable_name, 1024);
+ strsize1 = ucs2_strsize(variable_name, EFI_VAR_NAME_LEN);
list_for_each_entry_safe(entry, n, head, list) {
- strsize2 = ucs2_strsize(entry->var.VariableName, 1024);
+ strsize2 = ucs2_strsize(entry->var.VariableName, EFI_VAR_NAME_LEN);
if (strsize1 == strsize2 &&
!memcmp(variable_name, &(entry->var.VariableName),
strsize2) &&
@@ -396,6 +396,7 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *,
do {
variable_name_size = 512;
+ BUILD_BUG_ON(EFI_VAR_NAME_LEN < 512);
status = efivar_get_next_variable(&variable_name_size,
variable_name,