[patch 0/8] kzfree()

From: Johannes Weiner
Date: Mon Feb 16 2009 - 10:04:49 EST


This series introduces kzfree() and converts callsites which do
memset() + kfree() explicitely.

The callsites may be incomplete, I used coccinelle [1] to find them.

Regarding the recent re-exporting of ksize() to modules and the
discussion around it [2], this removes the single modular in-tree user
of ksize() again (unless I overgrepped something).

kfree() uses ksize() internally to determine the size of the memory
region to zero out. This could mean overhead as the size is actually
that of the kmalloc cache the object is from, but memset() + kfree()
isn't really the common fast path pattern.

I left out w1 because I think it doesn't need to zero the memory at
all. I will take a deeper look into it and send a followup with
either a kzfree() conversion or removal of the memset() alltogether.

Hannes

[1] http://www.emn.fr/x-info/coccinelle/

@@
expression M, S;
@@

- memset(M, 0, S);
- kfree(M);
+ kzfree(M);

(from the back of my head, no coccinelle installed on this box)

[2] http://lkml.org/lkml/2009/2/10/144

arch/s390/crypto/prng.c | 3 +--
crypto/api.c | 5 +----
drivers/md/dm-crypt.c | 6 ++----
drivers/s390/crypto/zcrypt_pcixcc.c | 3 +--
drivers/usb/host/hwa-hc.c | 3 +--
drivers/usb/wusbcore/cbaf.c | 3 +--
fs/cifs/connect.c | 7 ++-----
fs/cifs/misc.c | 12 ++++--------
fs/ecryptfs/keystore.c | 3 +--
fs/ecryptfs/messaging.c | 3 +--
include/linux/slab.h | 1 +
mm/util.c | 19 +++++++++++++++++++
net/atm/mpoa_caches.c | 14 ++++----------
13 files changed, 39 insertions(+), 43 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/