@@ -68,12 +68,10 @@ extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk);
68
68
69
69
DECLARE_PER_CPU (unsigned long * , irq_stack_ptr );
70
70
71
- static inline bool on_irq_stack (unsigned long sp ,
71
+ static inline bool on_stack (unsigned long sp , unsigned long low ,
72
+ unsigned long high , enum stack_type type ,
72
73
struct stack_info * info )
73
74
{
74
- unsigned long low = (unsigned long )raw_cpu_read (irq_stack_ptr );
75
- unsigned long high = low + IRQ_STACK_SIZE ;
76
-
77
75
if (!low )
78
76
return false;
79
77
@@ -83,29 +81,28 @@ static inline bool on_irq_stack(unsigned long sp,
83
81
if (info ) {
84
82
info -> low = low ;
85
83
info -> high = high ;
86
- info -> type = STACK_TYPE_IRQ ;
84
+ info -> type = type ;
87
85
}
88
-
89
86
return true;
90
87
}
91
88
89
+ static inline bool on_irq_stack (unsigned long sp ,
90
+ struct stack_info * info )
91
+ {
92
+ unsigned long low = (unsigned long )raw_cpu_read (irq_stack_ptr );
93
+ unsigned long high = low + IRQ_STACK_SIZE ;
94
+
95
+ return on_stack (sp , low , high , STACK_TYPE_IRQ , info );
96
+ }
97
+
92
98
static inline bool on_task_stack (const struct task_struct * tsk ,
93
99
unsigned long sp ,
94
100
struct stack_info * info )
95
101
{
96
102
unsigned long low = (unsigned long )task_stack_page (tsk );
97
103
unsigned long high = low + THREAD_SIZE ;
98
104
99
- if (sp < low || sp >= high )
100
- return false;
101
-
102
- if (info ) {
103
- info -> low = low ;
104
- info -> high = high ;
105
- info -> type = STACK_TYPE_TASK ;
106
- }
107
-
108
- return true;
105
+ return on_stack (sp , low , high , STACK_TYPE_TASK , info );
109
106
}
110
107
111
108
#ifdef CONFIG_VMAP_STACK
@@ -117,16 +114,7 @@ static inline bool on_overflow_stack(unsigned long sp,
117
114
unsigned long low = (unsigned long )raw_cpu_ptr (overflow_stack );
118
115
unsigned long high = low + OVERFLOW_STACK_SIZE ;
119
116
120
- if (sp < low || sp >= high )
121
- return false;
122
-
123
- if (info ) {
124
- info -> low = low ;
125
- info -> high = high ;
126
- info -> type = STACK_TYPE_OVERFLOW ;
127
- }
128
-
129
- return true;
117
+ return on_stack (sp , low , high , STACK_TYPE_OVERFLOW , info );
130
118
}
131
119
#else
132
120
static inline bool on_overflow_stack (unsigned long sp ,
0 commit comments