From 722b80cdfb984ccb4bfdb4f07aad6ff33b61ae7d Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Mon, 10 Apr 2017 12:45:43 -0400 Subject: add kmalloc alloc_size attributes --- include/linux/slub_def.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/linux') diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index fd2dfb600..bf3d7cae3 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -110,7 +110,7 @@ struct kmem_cache { }; void *kmem_cache_alloc(struct kmem_cache *, gfp_t); -void *__kmalloc(size_t size, gfp_t flags); +void *__kmalloc(size_t size, gfp_t flags) __attribute__((alloc_size(1))); static __always_inline void * kmalloc_order(size_t size, gfp_t flags, unsigned int order) @@ -147,7 +147,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) return kmalloc_order_trace(size, flags, order); } -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) @@ -167,7 +167,7 @@ static __always_inline void *kmalloc(size_t size, 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); #ifdef CONFIG_TRACING -- cgit v1.2.3