aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/slab.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 80b2dfde2e80..42a6bea58af3 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -99,7 +99,21 @@ found:
99 return __kmalloc(size, flags); 99 return __kmalloc(size, flags);
100} 100}
101 101
102extern void *kcalloc(size_t, size_t, unsigned int __nocast); 102extern void *kzalloc(size_t, unsigned int __nocast);
103
104/**
105 * kcalloc - allocate memory for an array. The memory is set to zero.
106 * @n: number of elements.
107 * @size: element size.
108 * @flags: the type of memory to allocate.
109 */
110static inline void *kcalloc(size_t n, size_t size, unsigned int __nocast flags)
111{
112 if (n != 0 && size > INT_MAX / n)
113 return NULL;
114 return kzalloc(n * size, flags);
115}
116
103extern void kfree(const void *); 117extern void kfree(const void *);
104extern unsigned int ksize(const void *); 118extern unsigned int ksize(const void *);
105 119