FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 03-04-2009, 07:04 PM
 
Default md: use kzfree()

From: Johannes Weiner <hannes@cmpxchg.org>

Use kzfree() instead of memset() + kfree().

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Alasdair Kergon <dm-devel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

drivers/md/dm-crypt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff -puN drivers/md/dm-crypt.c~md-use-kzfree drivers/md/dm-crypt.c
--- a/drivers/md/dm-crypt.c~md-use-kzfree
+++ a/drivers/md/dm-crypt.c
@@ -1137,8 +1137,7 @@ bad_ivmode:
crypto_free_ablkcipher(tfm);
bad_cipher:
/* Must zero key material before freeing */
- memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
- kfree(cc);
+ kzfree(cc);
return -EINVAL;
}

@@ -1164,8 +1163,7 @@ static void crypt_dtr(struct dm_target *
dm_put_device(ti, cc->dev);

/* Must zero key material before freeing */
- memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
- kfree(cc);
+ kzfree(cc);
}

static int crypt_map(struct dm_target *ti, struct bio *bio,
_

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 05:07 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org