Skip to content

Commit

Permalink
openrisc: Use sigsp()
Browse files Browse the repository at this point in the history
Use sigsp() instead of the open coded variant.

Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
Richard Weinberger authored and Richard Weinberger committed Aug 6, 2014
1 parent a8040ff commit 8e2beaf
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions arch/openrisc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,30 +132,16 @@ static inline unsigned long align_sigframe(unsigned long sp)
* or the alternate stack.
*/

static inline void __user *get_sigframe(struct k_sigaction *ka,
static inline void __user *get_sigframe(struct ksignal *ksig,
struct pt_regs *regs, size_t frame_size)
{
unsigned long sp = regs->sp;
int onsigstack = on_sig_stack(sp);

/* redzone */
sp -= STACK_FRAME_OVERHEAD;

/* This is the X/Open sanctioned signal stack switching. */
if ((ka->sa.sa_flags & SA_ONSTACK) && !onsigstack) {
if (current->sas_ss_size)
sp = current->sas_ss_sp + current->sas_ss_size;
}

sp = sigsp(sp, ksig);
sp = align_sigframe(sp - frame_size);

/*
* If we are on the alternate signal stack and would overflow it, don't.
* Return an always-bogus address instead so we will die with SIGSEGV.
*/
if (onsigstack && !likely(on_sig_stack(sp)))
return (void __user *)-1L;

return (void __user *)sp;
}

Expand All @@ -173,7 +159,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
unsigned long return_ip;
int err = 0;

frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
frame = get_sigframe(ksig, regs, sizeof(*frame));

if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return -EFAULT;
Expand Down

0 comments on commit 8e2beaf

Please sign in to comment.