aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2006-02-01 06:05:52 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-01 11:53:18 -0500
commit7fd6b1413082c303613fc137aca9a004740cacf0 (patch)
tree3186f4fdecbda4f16558c393a05408f7d3799ad4 /include
parentb958f7d9f35bfb61625f201cd92a3fc39504af7a (diff)
[PATCH] slab: fix kzalloc and kstrdup caller report for CONFIG_DEBUG_SLAB
Fix kzalloc() and kstrdup() caller report for CONFIG_DEBUG_SLAB. We must pass the caller to __cache_alloc() instead of directly doing __builtin_return_address(0) there; otherwise kzalloc() and kstrdup() are reported as the allocation site instead of the real one. Thanks to Valdis Kletnieks for reporting the problem and Steven Rostedt for the original idea. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/slab.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 1fb77a9cc148..8cf52939d0ab 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -76,7 +76,14 @@ struct cache_sizes {
76 kmem_cache_t *cs_dmacachep; 76 kmem_cache_t *cs_dmacachep;
77}; 77};
78extern struct cache_sizes malloc_sizes[]; 78extern struct cache_sizes malloc_sizes[];
79
80#ifndef CONFIG_DEBUG_SLAB
79extern void *__kmalloc(size_t, gfp_t); 81extern void *__kmalloc(size_t, gfp_t);
82#else
83extern void *__kmalloc_track_caller(size_t, gfp_t, void*);
84#define __kmalloc(size, flags) \
85 __kmalloc_track_caller(size, flags, __builtin_return_address(0))
86#endif
80 87
81static inline void *kmalloc(size_t size, gfp_t flags) 88static inline void *kmalloc(size_t size, gfp_t flags)
82{ 89{