aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2004-08-25 12:59:52 +0200
committerJaroslav Kysela <perex@suse.cz>2004-08-25 12:59:52 +0200
commit33ae6fc268acfb8cce68420577b6a13c982b87cf (patch)
tree45886d28946b9d4c94f2034b9f27729b0583059a /mm
parent5a528e759df146b064f64a54bc05f709568166ca (diff)
parentf4c09ca73f1517e4c0a5566de1fdc3f9142b06b2 (diff)
downloadhistory-33ae6fc268acfb8cce68420577b6a13c982b87cf.tar.gz
Merge bk://linux-sound@linux-sound.bkbits.net/linux-sound
into suse.cz:/home/perex/bk/linux-sound/linux-sound
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 fd80d31fbab0ae..9531261568f0c9 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2424,6 +2424,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.
*