diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-08 05:41:28 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-08 05:41:28 -0400 |
commit | 142e27fc8a3619471669d6241784eec9167c47d1 (patch) | |
tree | e88850b63ec910ee28874f93c43fb66421bb8119 /include/linux/slab.h | |
parent | a9053d0494d3c92807701c0f47df61d50c971581 (diff) | |
parent | caf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'include/linux/slab.h')
-rw-r--r-- | include/linux/slab.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 80b2dfde2e8..42a6bea58af 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -99,7 +99,21 @@ found: return __kmalloc(size, flags); } -extern void *kcalloc(size_t, size_t, unsigned int __nocast); +extern void *kzalloc(size_t, unsigned int __nocast); + +/** + * 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. + */ +static inline void *kcalloc(size_t n, size_t size, unsigned int __nocast flags) +{ + if (n != 0 && size > INT_MAX / n) + return NULL; + return kzalloc(n * size, flags); +} + extern void kfree(const void *); extern unsigned int ksize(const void *); |