aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-26 23:24:18 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-26 23:24:18 -0700
commit0b999e41892862d1b89911558cd5449b070885c6 (patch)
treeec94867344f1f3081f0a4bc98f78b563d6d5ad3d /mm
parenta6ee9b32bc33269e8f7bb98da2143c90fba620d6 (diff)
parent7fce3cf04fb0fad4c4a91707d6a7632eaa7c2b55 (diff)
downloadhistory-0b999e41892862d1b89911558cd5449b070885c6.tar.gz
Merge http://linux-sound.bkbits.net/linux-sound
into ppc970.osdl.org:/home/torvalds/v2.6/linux
Diffstat (limited to 'mm')
-rw-r--r--mm/slab.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 42945158704809..21a54adbc4c43d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2480,6 +2480,27 @@ void kmem_cache_free (kmem_cache_t *cachep, void *objp)
EXPORT_SYMBOL(kmem_cache_free);
/**
+ * kcalloc - allocate memory for an array. The memory is set to zero.
+ * @n: number of elements.
+ * @size: element size.
+ * @flags: the type of memory to allocate.
+ */
+void *kcalloc(size_t n, size_t size, int flags)
+{
+ void *ret = NULL;
+
+ if (n != 0 && size > INT_MAX / n)
+ return ret;
+
+ ret = kmalloc(n * size, flags);
+ if (ret)
+ memset(ret, 0, n * size);
+ return ret;
+}
+
+EXPORT_SYMBOL(kcalloc);
+
+/**
* kfree - free previously allocated memory
* @objp: pointer returned by kmalloc.
*