From: Kees Cook Date: Mon, 11 Jun 2018 21:35:55 +0000 (-0700) Subject: mm: Introduce kvcalloc() X-Git-Tag: v5.15~8613^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c542f38ab8d30d9c852a16d49ac5a15267bbf1f;p=platform%2Fkernel%2Flinux-starfive.git 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: Kees Cook --- diff --git a/include/linux/mm.h b/include/linux/mm.h index 0e493884e6e1..a0fbb9ffe380 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -575,6 +575,11 @@ static inline void *kvmalloc_array(size_t n, size_t size, gfp_t 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); static inline atomic_t *compound_mapcount_ptr(struct page *page)