Commit 1c542f38 authored by Kees Cook's avatar Kees Cook

mm: Introduce kvcalloc()

The kv*alloc()-family was missing kvcalloc(). Adding this allows for
2-argument multiplication conversions of kvzalloc(a * b, ...) into
kvcalloc(a, b, ...).
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 9f645bcc
...@@ -575,6 +575,11 @@ static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags) ...@@ -575,6 +575,11 @@ static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
return kvmalloc(bytes, flags); return kvmalloc(bytes, flags);
} }
static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
{
return kvmalloc_array(n, size, flags | __GFP_ZERO);
}
extern void kvfree(const void *addr); extern void kvfree(const void *addr);
static inline atomic_t *compound_mapcount_ptr(struct page *page) static inline atomic_t *compound_mapcount_ptr(struct page *page)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment