diff options
-rw-r--r-- | include/linux/sched.h | 7 | ||||
-rw-r--r-- | lib/debugobjects.c | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index dc7e592c473a..6aca4a16e377 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1983,6 +1983,13 @@ static inline unsigned long *end_of_stack(struct task_struct *p) | |||
1983 | 1983 | ||
1984 | #endif | 1984 | #endif |
1985 | 1985 | ||
1986 | static inline int object_is_on_stack(void *obj) | ||
1987 | { | ||
1988 | void *stack = task_stack_page(current); | ||
1989 | |||
1990 | return (obj >= stack) && (obj < (stack + THREAD_SIZE)); | ||
1991 | } | ||
1992 | |||
1986 | extern void thread_info_cache_init(void); | 1993 | extern void thread_info_cache_init(void); |
1987 | 1994 | ||
1988 | /* set thread flags in other task's structures | 1995 | /* set thread flags in other task's structures |
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 85b18d79be89..f86196390cfd 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c | |||
@@ -226,15 +226,13 @@ debug_object_fixup(int (*fixup)(void *addr, enum debug_obj_state state), | |||
226 | 226 | ||
227 | static void debug_object_is_on_stack(void *addr, int onstack) | 227 | static void debug_object_is_on_stack(void *addr, int onstack) |
228 | { | 228 | { |
229 | void *stack = current->stack; | ||
230 | int is_on_stack; | 229 | int is_on_stack; |
231 | static int limit; | 230 | static int limit; |
232 | 231 | ||
233 | if (limit > 4) | 232 | if (limit > 4) |
234 | return; | 233 | return; |
235 | 234 | ||
236 | is_on_stack = (addr >= stack && addr < (stack + THREAD_SIZE)); | 235 | is_on_stack = object_is_on_stack(addr); |
237 | |||
238 | if (is_on_stack == onstack) | 236 | if (is_on_stack == onstack) |
239 | return; | 237 | return; |
240 | 238 | ||