efivarfs: Drop redundant cleanup on fill_super() failure
Subsystems (2)
PATCH 1/2 efivarfs: Drop redundant cleanup on fill_super() failure
From: Ard Biesheuvel <[email protected]>
Al points out that kill_sb() will be called if efivarfs_fill_super() fails and so there is no point in cleaning up the efivar entry list.
Reported-by Alexander Viro <[email protected]>
Signed-off-by Ard Biesheuvel <[email protected]>
--- fs/efivarfs/super.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
fs/efivarfs/super.c +1 -6
@@ -343,12 +343,7 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc)if (err)return err; - err =efivar_init (efivarfs_callback, (void *)sb, true, - &sfi->efivarfs_list); -if (err) -efivar_entry_iter (efivarfs_destroy, &sfi->efivarfs_list,NULL ); - -return err; +return efivar_init (efivarfs_callback, sb, true, &sfi->efivarfs_list); }static int efivarfs_get_tree (struct fs_context *fc)
Signature · 1 line
2.44.0.rc0.258.g7320e95886-goog
PATCH 2/2 efivarfs: Drop 'duplicates' bool parameter on efivar_init()
From: Ard Biesheuvel <[email protected]>
The 'duplicates' bool argument is always true when efivar_init() is called from its only caller so let's just drop it instead.
Signed-off-by Ard Biesheuvel <[email protected]>
--- fs/efivarfs/internal.h | 2 +- fs/efivarfs/super.c | 2 +- fs/efivarfs/vars.c | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-)
fs/efivarfs/internal.h +1 -1
@@ -38,7 +38,7 @@ struct efivar_entry {int efivar_init (int (*func)(efi_char16_t *,efi_guid_t ,unsigned long ,void *,struct list_head *), -void *data,bool duplicates,struct list_head *head); +void *data,struct list_head *head);int efivar_entry_add (struct efivar_entry *entry,struct list_head *head);void __efivar_entry_add (struct efivar_entry *entry,struct list_head *head);
fs/efivarfs/super.c +1 -1
@@ -343,7 +343,7 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc)if (err)return err; -return efivar_init (efivarfs_callback, sb, true, &sfi->efivarfs_list); +return efivar_init (efivarfs_callback, sb, &sfi->efivarfs_list); }static int efivarfs_get_tree (struct fs_context *fc)
fs/efivarfs/vars.c +2 -4
@@ -361,7 +361,6 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid,* efivar_init - build the initial list of EFI variables * @func: callback function to invoke for every variable * @data: function-specific data to pass to @func -* @duplicates: error if we encounter duplicates on @head? * @head: initialised head of variable list * * Get every EFI variable from the firmware and invoke @func. @func
@@ -371,7 +370,7 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid,*/ int efivar_init (int (*func)(efi_char16_t *,efi_guid_t ,unsigned long ,void *,struct list_head *), -void *data,bool duplicates,struct list_head *head) +void *data,struct list_head *head) {unsigned long variable_name_size =1024 ;efi_char16_t *variable_name;
@@ -413,8 +412,7 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *,* we'll ever see a different variable name, * and may end up looping here forever. */ -if (duplicates && -variable_is_present (variable_name, &vendor_guid, +if (variable_is_present (variable_name, &vendor_guid, head)) {dup_variable_bug (variable_name, &vendor_guid, variable_name_size);
Signature · 1 line
2.44.0.rc0.258.g7320e95886-goog