Commit ca9e1605 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/signal32: Remove ifdefery in middle of if/else in sigreturn()

In the same spirit as commit f1cf4f93 ("powerpc/signal32: Remove
ifdefery in middle of if/else")

MSR_TM_ACTIVE() is always defined and returns always 0 when
CONFIG_PPC_TRANSACTIONAL_MEM is not selected, so the awful
ifdefery in the middle of an if/else can be removed.

Make 'msr_hi' a 'long long' to avoid build failure on PPC32
due to the 32 bits left shift.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/a4b48b2f0be1ef13fc8e57452b7f8350da28d521.1616151715.git.christophe.leroy@csgroup.eu
parent f918a81e
...@@ -740,6 +740,12 @@ static long restore_tm_user_regs(struct pt_regs *regs, ...@@ -740,6 +740,12 @@ static long restore_tm_user_regs(struct pt_regs *regs,
return 0; return 0;
} }
#else
static long restore_tm_user_regs(struct pt_regs *regs, struct mcontext __user *sr,
struct mcontext __user *tm_sr)
{
return 0;
}
#endif #endif
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
...@@ -1317,10 +1323,9 @@ SYSCALL_DEFINE0(sigreturn) ...@@ -1317,10 +1323,9 @@ SYSCALL_DEFINE0(sigreturn)
struct mcontext __user *sr; struct mcontext __user *sr;
void __user *addr; void __user *addr;
sigset_t set; sigset_t set;
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM struct mcontext __user *mcp;
struct mcontext __user *mcp, *tm_mcp; struct mcontext __user *tm_mcp = NULL;
unsigned long msr_hi; unsigned long long msr_hi = 0;
#endif
/* Always make any pending restarted system calls return -EINTR */ /* Always make any pending restarted system calls return -EINTR */
current->restart_block.fn = do_no_restart_syscall; current->restart_block.fn = do_no_restart_syscall;
...@@ -1343,19 +1348,18 @@ SYSCALL_DEFINE0(sigreturn) ...@@ -1343,19 +1348,18 @@ SYSCALL_DEFINE0(sigreturn)
#endif #endif
set_current_blocked(&set); set_current_blocked(&set);
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
mcp = (struct mcontext __user *)&sf->mctx; mcp = (struct mcontext __user *)&sf->mctx;
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
tm_mcp = (struct mcontext __user *)&sf->mctx_transact; tm_mcp = (struct mcontext __user *)&sf->mctx_transact;
if (__get_user(msr_hi, &tm_mcp->mc_gregs[PT_MSR])) if (__get_user(msr_hi, &tm_mcp->mc_gregs[PT_MSR]))
goto badframe; goto badframe;
#endif
if (MSR_TM_ACTIVE(msr_hi<<32)) { if (MSR_TM_ACTIVE(msr_hi<<32)) {
if (!cpu_has_feature(CPU_FTR_TM)) if (!cpu_has_feature(CPU_FTR_TM))
goto badframe; goto badframe;
if (restore_tm_user_regs(regs, mcp, tm_mcp)) if (restore_tm_user_regs(regs, mcp, tm_mcp))
goto badframe; goto badframe;
} else } else {
#endif
{
sr = (struct mcontext __user *)from_user_ptr(sigctx.regs); sr = (struct mcontext __user *)from_user_ptr(sigctx.regs);
addr = sr; addr = sr;
if (!access_ok(sr, sizeof(*sr)) if (!access_ok(sr, sizeof(*sr))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment