Skip to content

Commit

Permalink
add kmalloc alloc_size attributes
Browse files Browse the repository at this point in the history
Signed-off-by: khusika <khusikadhamar@gmail.com>
  • Loading branch information
thestinger authored and khusika committed Aug 28, 2018
1 parent 4a22d27 commit d76a526
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/linux/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,11 @@ static __always_inline int kmalloc_index(size_t size)
}
#endif /* !CONFIG_SLOB */

void *__kmalloc(size_t size, gfp_t flags);
void *__kmalloc(size_t size, gfp_t flags) __attribute__((alloc_size(1)));
void *kmem_cache_alloc(struct kmem_cache *, gfp_t flags);

#ifdef CONFIG_NUMA
void *__kmalloc_node(size_t size, gfp_t flags, int node);
void *__kmalloc_node(size_t size, gfp_t flags, int node) __attribute__((alloc_size(1)));
void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
#else
static __always_inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
Expand Down Expand Up @@ -428,7 +428,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
* for general use, and so are not documented here. For a full list of
* potential flags, always refer to linux/gfp.h.
*/
static __always_inline void *kmalloc(size_t size, gfp_t flags)
static __always_inline __attribute__((alloc_size(1))) void *kmalloc(size_t size, gfp_t flags)
{
if (__builtin_constant_p(size)) {
if (size > KMALLOC_MAX_CACHE_SIZE)
Expand Down

0 comments on commit d76a526

Please sign in to comment.