Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297208
b: refs/heads/master
c: a820372
h: refs/heads/master
v: v3
  • Loading branch information
Xi Wang authored and Pekka Enberg committed Mar 6, 2012
1 parent b88fbb3 commit d5fc8a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8028dcea8abbbd51b5156e40ea214c20b559cd01
refs/heads/master: a8203725dfded5c1f79dca3368a4a273e24b59bb
17 changes: 14 additions & 3 deletions trunk/include/linux/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ size_t ksize(const void *);
#endif

/**
* kcalloc - allocate memory for an array. The memory is set to zero.
* kmalloc_array - allocate memory for an array.
* @n: number of elements.
* @size: element size.
* @flags: the type of memory to allocate.
Expand Down Expand Up @@ -240,11 +240,22 @@ size_t ksize(const void *);
* for general use, and so are not documented here. For a full list of
* potential flags, always refer to linux/gfp.h.
*/
static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
{
if (size != 0 && n > ULONG_MAX / size)
return NULL;
return __kmalloc(n * size, flags | __GFP_ZERO);
return __kmalloc(n * size, flags);
}

/**
* kcalloc - allocate memory for an array. The memory is set to zero.
* @n: number of elements.
* @size: element size.
* @flags: the type of memory to allocate (see kmalloc).
*/
static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
{
return kmalloc_array(n, size, flags | __GFP_ZERO);
}

#if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB)
Expand Down

0 comments on commit d5fc8a8

Please sign in to comment.