diff mbox series

block/keyslot-manager: use kvfree_sensitive()

Message ID 20200616155654.191263-1-ebiggers@kernel.org (mailing list archive)
State New, archived
Headers show
Series block/keyslot-manager: use kvfree_sensitive() | expand

Commit Message

Eric Biggers June 16, 2020, 3:56 p.m. UTC
From: Eric Biggers <ebiggers@google.com>

Make blk_ksm_destroy() use the kvfree_sensitive() function (which was
introduced in v5.8-rc1) instead of open-coding it.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 block/keyslot-manager.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Eric Biggers June 29, 2020, 4:51 p.m. UTC | #1
On Tue, Jun 16, 2020 at 08:56:54AM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Make blk_ksm_destroy() use the kvfree_sensitive() function (which was
> introduced in v5.8-rc1) instead of open-coding it.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  block/keyslot-manager.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/keyslot-manager.c b/block/keyslot-manager.c
> index c2ef41b3147b..35abcb1ec051 100644
> --- a/block/keyslot-manager.c
> +++ b/block/keyslot-manager.c
> @@ -374,8 +374,7 @@ void blk_ksm_destroy(struct blk_keyslot_manager *ksm)
>  	if (!ksm)
>  		return;
>  	kvfree(ksm->slot_hashtable);
> -	memzero_explicit(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
> -	kvfree(ksm->slots);
> +	kvfree_sensitive(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
>  	memzero_explicit(ksm, sizeof(*ksm));
>  }
>  EXPORT_SYMBOL_GPL(blk_ksm_destroy);
> -- 

Ping?
Jens Axboe June 29, 2020, 7:24 p.m. UTC | #2
On 6/29/20 10:51 AM, Eric Biggers wrote:
> On Tue, Jun 16, 2020 at 08:56:54AM -0700, Eric Biggers wrote:
>> From: Eric Biggers <ebiggers@google.com>
>>
>> Make blk_ksm_destroy() use the kvfree_sensitive() function (which was
>> introduced in v5.8-rc1) instead of open-coding it.
>>
>> Signed-off-by: Eric Biggers <ebiggers@google.com>
>> ---
>>  block/keyslot-manager.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/block/keyslot-manager.c b/block/keyslot-manager.c
>> index c2ef41b3147b..35abcb1ec051 100644
>> --- a/block/keyslot-manager.c
>> +++ b/block/keyslot-manager.c
>> @@ -374,8 +374,7 @@ void blk_ksm_destroy(struct blk_keyslot_manager *ksm)
>>  	if (!ksm)
>>  		return;
>>  	kvfree(ksm->slot_hashtable);
>> -	memzero_explicit(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
>> -	kvfree(ksm->slots);
>> +	kvfree_sensitive(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
>>  	memzero_explicit(ksm, sizeof(*ksm));
>>  }
>>  EXPORT_SYMBOL_GPL(blk_ksm_destroy);
>> -- 
> 
> Ping?

Applied, thanks.
diff mbox series

Patch

diff --git a/block/keyslot-manager.c b/block/keyslot-manager.c
index c2ef41b3147b..35abcb1ec051 100644
--- a/block/keyslot-manager.c
+++ b/block/keyslot-manager.c
@@ -374,8 +374,7 @@  void blk_ksm_destroy(struct blk_keyslot_manager *ksm)
 	if (!ksm)
 		return;
 	kvfree(ksm->slot_hashtable);
-	memzero_explicit(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
-	kvfree(ksm->slots);
+	kvfree_sensitive(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
 	memzero_explicit(ksm, sizeof(*ksm));
 }
 EXPORT_SYMBOL_GPL(blk_ksm_destroy);