aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2014-03-05 08:54:10 -0500
committerRichard Weinberger <richard@sigma-star.at>2014-08-06 07:04:07 -0400
commit8215ade82d699be33a2fa545bceca29c95fcfa47 (patch)
tree860e603c37024172dd05a9d169f2c7fe1851d2c4
parent615869e40bc0f84bc73d43e83ab88a7d4b66759f (diff)
cris: Use sigsp()
Use sigsp() instead of the open coded variant. Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--arch/cris/arch-v10/kernel/signal.c14
-rw-r--r--arch/cris/arch-v32/kernel/signal.c16
2 files changed, 8 insertions, 22 deletions
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
index 12aac1fb48df..9b32d338838b 100644
--- a/arch/cris/arch-v10/kernel/signal.c
+++ b/arch/cris/arch-v10/kernel/signal.c
@@ -203,15 +203,9 @@ static int setup_sigcontext(struct sigcontext __user *sc,
203 * - usually on the stack. */ 203 * - usually on the stack. */
204 204
205static inline void __user * 205static inline void __user *
206get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 206get_sigframe(struct ksignal *ksig, size_t frame_size)
207{ 207{
208 unsigned long sp = rdusp(); 208 unsigned long sp = sigsp(rdusp(), ksig);
209
210 /* This is the X/Open sanctioned signal stack switching. */
211 if (ka->sa.sa_flags & SA_ONSTACK) {
212 if (! on_sig_stack(sp))
213 sp = current->sas_ss_sp + current->sas_ss_size;
214 }
215 209
216 /* make sure the frame is dword-aligned */ 210 /* make sure the frame is dword-aligned */
217 211
@@ -235,7 +229,7 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set,
235 unsigned long return_ip; 229 unsigned long return_ip;
236 int err = 0; 230 int err = 0;
237 231
238 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame)); 232 frame = get_sigframe(ksig, sizeof(*frame));
239 233
240 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 234 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
241 return -EFAULT; 235 return -EFAULT;
@@ -287,7 +281,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
287 unsigned long return_ip; 281 unsigned long return_ip;
288 int err = 0; 282 int err = 0;
289 283
290 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame)); 284 frame = get_sigframe(ksig, sizeof(*frame));
291 285
292 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 286 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
293 return -EFAULT; 287 return -EFAULT;
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index cc7a39a74aec..78ce3b1c9bcb 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -189,17 +189,9 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
189 189
190/* Figure out where to put the new signal frame - usually on the stack. */ 190/* Figure out where to put the new signal frame - usually on the stack. */
191static inline void __user * 191static inline void __user *
192get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) 192get_sigframe(struct ksignal *ksig, size_t frame_size)
193{ 193{
194 unsigned long sp; 194 unsigned long sp = sigsp(rdusp(), ksig);
195
196 sp = rdusp();
197
198 /* This is the X/Open sanctioned signal stack switching. */
199 if (ka->sa.sa_flags & SA_ONSTACK) {
200 if (!on_sig_stack(sp))
201 sp = current->sas_ss_sp + current->sas_ss_size;
202 }
203 195
204 /* Make sure the frame is dword-aligned. */ 196 /* Make sure the frame is dword-aligned. */
205 sp &= ~3; 197 sp &= ~3;
@@ -222,7 +214,7 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
222 struct signal_frame __user *frame; 214 struct signal_frame __user *frame;
223 215
224 err = 0; 216 err = 0;
225 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame)); 217 frame = get_sigframe(ksig, sizeof(*frame));
226 218
227 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 219 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
228 return -EFAULT; 220 return -EFAULT;
@@ -290,7 +282,7 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
290 struct rt_signal_frame __user *frame; 282 struct rt_signal_frame __user *frame;
291 283
292 err = 0; 284 err = 0;
293 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame)); 285 frame = get_sigframe(ksig, sizeof(*frame));
294 286
295 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 287 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
296 return -EFAULT; 288 return -EFAULT;