Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 131578
b: refs/heads/master
c: 3ef0e5b
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Weiner authored and Linus Torvalds committed Feb 21, 2009
1 parent e81a3c7 commit fd21c91
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d9190913b71831f5e3d04de62cfb1fd069a9db35
refs/heads/master: 3ef0e5ba467366125f04b423f4638baca54a4fc1
1 change: 1 addition & 0 deletions trunk/include/linux/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);
void * __must_check __krealloc(const void *, size_t, gfp_t);
void * __must_check krealloc(const void *, size_t, gfp_t);
void kfree(const void *);
void kzfree(const void *);
size_t ksize(const void *);

/*
Expand Down
20 changes: 20 additions & 0 deletions trunk/mm/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fd21c91

Please sign in to comment.