Skip to content

Commit

Permalink
mm: Introduce kvcalloc()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kees committed Jun 12, 2018
1 parent 9f645bc commit 1c542f3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1c542f3

Please sign in to comment.