Skip to content

Commit d995966

Browse files
committed
openrisc: signal: Fix sparse address space warnings
The __user annotations in signal.c were mostly missing. The missing annotations caused the warnings listed below. This patch fixes them up by adding the __user annotations. arch/openrisc/kernel/signal.c:71:38: warning: incorrect type in initializer (different address spaces) arch/openrisc/kernel/signal.c:71:38: expected struct rt_sigframe *frame arch/openrisc/kernel/signal.c:71:38: got struct rt_sigframe [noderef] __user * arch/openrisc/kernel/signal.c:82:14: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:82:14: expected void const volatile [noderef] __user * arch/openrisc/kernel/signal.c:82:14: got struct rt_sigframe *frame arch/openrisc/kernel/signal.c:84:37: warning: incorrect type in argument 2 (different address spaces) arch/openrisc/kernel/signal.c:84:37: expected void const [noderef] __user *from arch/openrisc/kernel/signal.c:84:37: got struct sigset_t * arch/openrisc/kernel/signal.c:89:39: warning: incorrect type in argument 2 (different address spaces) arch/openrisc/kernel/signal.c:89:39: expected struct sigcontext [noderef] __user *sc arch/openrisc/kernel/signal.c:89:39: got struct sigcontext * arch/openrisc/kernel/signal.c:92:31: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:92:31: expected struct sigaltstack const [noderef] [usertype] __user * arch/openrisc/kernel/signal.c:92:31: got struct sigaltstack * arch/openrisc/kernel/signal.c:158:15: warning: incorrect type in assignment (different address spaces) arch/openrisc/kernel/signal.c:158:15: expected struct rt_sigframe *frame arch/openrisc/kernel/signal.c:158:15: got void [noderef] __user * arch/openrisc/kernel/signal.c:160:14: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:160:14: expected void const volatile [noderef] __user * arch/openrisc/kernel/signal.c:160:14: got struct rt_sigframe *frame arch/openrisc/kernel/signal.c:165:46: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:165:46: expected struct siginfo [noderef] [usertype] __user *to arch/openrisc/kernel/signal.c:165:46: got struct siginfo * arch/openrisc/kernel/signal.c:170:33: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:170:33: expected struct sigaltstack [noderef] [usertype] __user * arch/openrisc/kernel/signal.c:170:33: got struct sigaltstack * arch/openrisc/kernel/signal.c:171:40: warning: incorrect type in argument 2 (different address spaces) arch/openrisc/kernel/signal.c:171:40: expected struct sigcontext [noderef] __user *sc arch/openrisc/kernel/signal.c:171:40: got struct sigcontext * arch/openrisc/kernel/signal.c:173:32: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:173:32: expected void [noderef] __user *to arch/openrisc/kernel/signal.c:173:32: got struct sigset_t * Signed-off-by: Stafford Horne <[email protected]> Reviewed-by: Luc Van Oostenryck <[email protected]>
1 parent aac9a9b commit d995966

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

arch/openrisc/kernel/signal.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ static int restore_sigcontext(struct pt_regs *regs,
6868

6969
asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs)
7070
{
71-
struct rt_sigframe *frame = (struct rt_sigframe __user *)regs->sp;
71+
struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->sp;
7272
sigset_t set;
7373

7474
/*
7575
* Since we stacked the signal on a dword boundary,
7676
* then frame should be dword aligned here. If it's
7777
* not, then the user is trying to mess with us.
7878
*/
79-
if (((long)frame) & 3)
79+
if (((unsigned long)frame) & 3)
8080
goto badframe;
8181

8282
if (!access_ok(frame, sizeof(*frame)))
@@ -151,7 +151,7 @@ static inline void __user *get_sigframe(struct ksignal *ksig,
151151
static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
152152
struct pt_regs *regs)
153153
{
154-
struct rt_sigframe *frame;
154+
struct rt_sigframe __user *frame;
155155
unsigned long return_ip;
156156
int err = 0;
157157

@@ -181,10 +181,10 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
181181
l.ori r11,r0,__NR_sigreturn
182182
l.sys 1
183183
*/
184-
err |= __put_user(0xa960, (short *)(frame->retcode + 0));
185-
err |= __put_user(__NR_rt_sigreturn, (short *)(frame->retcode + 2));
186-
err |= __put_user(0x20000001, (unsigned long *)(frame->retcode + 4));
187-
err |= __put_user(0x15000000, (unsigned long *)(frame->retcode + 8));
184+
err |= __put_user(0xa960, (short __user *)(frame->retcode + 0));
185+
err |= __put_user(__NR_rt_sigreturn, (short __user *)(frame->retcode + 2));
186+
err |= __put_user(0x20000001, (unsigned long __user *)(frame->retcode + 4));
187+
err |= __put_user(0x15000000, (unsigned long __user *)(frame->retcode + 8));
188188

189189
if (err)
190190
return -EFAULT;

0 commit comments

Comments
 (0)