Re: [patch 7/8] ecryptfs: use kzfree()
From: Tyler Hicks
Date: Tue Feb 17 2009 - 02:51:54 EST
Johannes Weiner wrote:
> Use kzfree() instead of memset() + kfree().
>
> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> Cc: Tyler Hicks <tyhicks@xxxxxxxxxxxxxxxxxx>
Acked-by: Tyler Hicks <tyhicks@xxxxxxxxxxxxxxxxxx>
Thanks for kzfree() and the updates to eCryptfs - I will put it to use
in the future.
> ---
> fs/ecryptfs/keystore.c | 3 +--
> fs/ecryptfs/messaging.c | 3 +--
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> --- a/fs/ecryptfs/keystore.c
> +++ b/fs/ecryptfs/keystore.c
> @@ -740,8 +740,7 @@ ecryptfs_write_tag_70_packet(char *dest,
> out_release_free_unlock:
> crypto_free_hash(s->hash_desc.tfm);
> out_free_unlock:
> - memset(s->block_aligned_filename, 0, s->block_aligned_filename_size);
> - kfree(s->block_aligned_filename);
> + kzfree(s->block_aligned_filename);
> out_unlock:
> mutex_unlock(s->tfm_mutex);
> out:
> --- a/fs/ecryptfs/messaging.c
> +++ b/fs/ecryptfs/messaging.c
> @@ -291,8 +291,7 @@ int ecryptfs_exorcise_daemon(struct ecry
> if (daemon->user_ns)
> put_user_ns(daemon->user_ns);
> mutex_unlock(&daemon->mux);
> - memset(daemon, 0, sizeof(*daemon));
> - kfree(daemon);
> + kzfree(daemon);
> out:
> return rc;
> }
>
>
Attachment:
signature.asc
Description: OpenPGP digital signature