diff options
author | Ingo Molnar | 2009-03-05 11:45:22 +0100 |
---|---|---|
committer | Ingo Molnar | 2009-03-05 11:45:22 +0100 |
commit | a140feab42d1cfd811930ab76104559c19dfc4b0 (patch) | |
tree | 41fd871990e888dd5616a6bf1891a1ff307221df /mm/util.c | |
parent | lockdep: require framepointers for x86 (diff) | |
parent | Linux 2.6.29-rc7 (diff) | |
download | kernel-qcow2-linux-a140feab42d1cfd811930ab76104559c19dfc4b0.tar.gz kernel-qcow2-linux-a140feab42d1cfd811930ab76104559c19dfc4b0.tar.xz kernel-qcow2-linux-a140feab42d1cfd811930ab76104559c19dfc4b0.zip |
Merge commit 'v2.6.29-rc7' into core/locking
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mm/util.c b/mm/util.c index cb00b748ce47..37eaccdf3054 100644 --- a/mm/util.c +++ b/mm/util.c @@ -129,6 +129,26 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags) } EXPORT_SYMBOL(krealloc); +/** + * kzfree - like kfree but zero memory + * @p: object to free memory of + * + * The memory of the object @p points to is zeroed before freed. + * If @p is %NULL, kzfree() does nothing. + */ +void kzfree(const void *p) +{ + size_t ks; + void *mem = (void *)p; + + if (unlikely(ZERO_OR_NULL_PTR(mem))) + return; + ks = ksize(mem); + memset(mem, 0, ks); + kfree(mem); +} +EXPORT_SYMBOL(kzfree); + /* * strndup_user - duplicate an existing string from user space * @s: The string to duplicate |