diff options
author | Kees Cook <keescook@chromium.org> | 2018-06-11 17:35:55 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2018-06-12 19:19:22 -0400 |
commit | 1c542f38ab8d30d9c852a16d49ac5a15267bbf1f (patch) | |
tree | 20ace1eb1fe5b61211f5dfcd10a5af136682ebd4 | |
parent | 9f645bcc566a1e9f921bdae7528a01ced5bc3713 (diff) |
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 <keescook@chromium.org>
-rw-r--r-- | include/linux/mm.h | 5 |
1 files changed, 5 insertions, 0 deletions
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) | |||
575 | return kvmalloc(bytes, flags); | 575 | return kvmalloc(bytes, flags); |
576 | } | 576 | } |
577 | 577 | ||
578 | static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) | ||
579 | { | ||
580 | return kvmalloc_array(n, size, flags | __GFP_ZERO); | ||
581 | } | ||
582 | |||
578 | extern void kvfree(const void *addr); | 583 | extern void kvfree(const void *addr); |
579 | 584 | ||
580 | static inline atomic_t *compound_mapcount_ptr(struct page *page) | 585 | static inline atomic_t *compound_mapcount_ptr(struct page *page) |