diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-02-19 09:46:44 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-03-21 08:27:46 -0500 |
commit | 9c6031cc93626a194a9ef32d62b078ef1b396c45 (patch) | |
tree | ccc33703eb7e47193f06cbe995754efde92e658b | |
parent | 6254944faf5ff96b8b468457e3e2b2dcacc29fb7 (diff) |
[MIPS] Signal cleanup
Move function prototypes to asm/signal.h to detect trivial errors and
add some __user tags to get rid of sparse warnings. Generated code
should not be changed.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/kernel/process.c | 16 | ||||
-rw-r--r-- | arch/mips/kernel/signal.c | 6 | ||||
-rw-r--r-- | arch/mips/kernel/signal32.c | 24 | ||||
-rw-r--r-- | arch/mips/kernel/signal_n32.c | 2 | ||||
-rw-r--r-- | include/asm-mips/signal.h | 20 |
5 files changed, 35 insertions, 33 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 092679c2dca9..a8f435d82940 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
@@ -60,17 +60,9 @@ ATTRIB_NORET void cpu_idle(void) | |||
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | extern void do_signal(struct pt_regs *regs); | ||
64 | extern void do_signal32(struct pt_regs *regs); | ||
65 | |||
66 | /* | 63 | /* |
67 | * Native o32 and N64 ABI without DSP ASE | 64 | * Native o32 and N64 ABI without DSP ASE |
68 | */ | 65 | */ |
69 | extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs, | ||
70 | int signr, sigset_t *set); | ||
71 | extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, | ||
72 | int signr, sigset_t *set, siginfo_t *info); | ||
73 | |||
74 | struct mips_abi mips_abi = { | 66 | struct mips_abi mips_abi = { |
75 | .do_signal = do_signal, | 67 | .do_signal = do_signal, |
76 | #ifdef CONFIG_TRAD_SIGNALS | 68 | #ifdef CONFIG_TRAD_SIGNALS |
@@ -83,11 +75,6 @@ struct mips_abi mips_abi = { | |||
83 | /* | 75 | /* |
84 | * o32 compatibility on 64-bit kernels, without DSP ASE | 76 | * o32 compatibility on 64-bit kernels, without DSP ASE |
85 | */ | 77 | */ |
86 | extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | ||
87 | int signr, sigset_t *set); | ||
88 | extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | ||
89 | int signr, sigset_t *set, siginfo_t *info); | ||
90 | |||
91 | struct mips_abi mips_abi_32 = { | 78 | struct mips_abi mips_abi_32 = { |
92 | .do_signal = do_signal32, | 79 | .do_signal = do_signal32, |
93 | .setup_frame = setup_frame_32, | 80 | .setup_frame = setup_frame_32, |
@@ -99,9 +86,6 @@ struct mips_abi mips_abi_32 = { | |||
99 | /* | 86 | /* |
100 | * N32 on 64-bit kernels, without DSP ASE | 87 | * N32 on 64-bit kernels, without DSP ASE |
101 | */ | 88 | */ |
102 | extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs, | ||
103 | int signr, sigset_t *set, siginfo_t *info); | ||
104 | |||
105 | struct mips_abi mips_abi_n32 = { | 89 | struct mips_abi mips_abi_n32 = { |
106 | .do_signal = do_signal, | 90 | .do_signal = do_signal, |
107 | .setup_rt_frame = setup_rt_frame_n32 | 91 | .setup_rt_frame = setup_rt_frame_n32 |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index c974cc9b30eb..402efd27c79e 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -100,8 +100,8 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
100 | } | 100 | } |
101 | 101 | ||
102 | #ifdef CONFIG_TRAD_SIGNALS | 102 | #ifdef CONFIG_TRAD_SIGNALS |
103 | asmlinkage int sys_sigaction(int sig, const struct sigaction *act, | 103 | asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act, |
104 | struct sigaction *oact) | 104 | struct sigaction __user *oact) |
105 | { | 105 | { |
106 | struct k_sigaction new_ka, old_ka; | 106 | struct k_sigaction new_ka, old_ka; |
107 | int ret; | 107 | int ret; |
@@ -331,7 +331,7 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, | |||
331 | /* Create the ucontext. */ | 331 | /* Create the ucontext. */ |
332 | err |= __put_user(0, &frame->rs_uc.uc_flags); | 332 | err |= __put_user(0, &frame->rs_uc.uc_flags); |
333 | err |= __put_user(NULL, &frame->rs_uc.uc_link); | 333 | err |= __put_user(NULL, &frame->rs_uc.uc_link); |
334 | err |= __put_user((void *)current->sas_ss_sp, | 334 | err |= __put_user((void __user *)current->sas_ss_sp, |
335 | &frame->rs_uc.uc_stack.ss_sp); | 335 | &frame->rs_uc.uc_stack.ss_sp); |
336 | err |= __put_user(sas_ss_flags(regs->regs[29]), | 336 | err |= __put_user(sas_ss_flags(regs->regs[29]), |
337 | &frame->rs_uc.uc_stack.ss_flags); | 337 | &frame->rs_uc.uc_stack.ss_flags); |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index f2791a1e7609..1c7241ba6924 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -163,7 +163,7 @@ static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf) | |||
163 | return err; | 163 | return err; |
164 | } | 164 | } |
165 | 165 | ||
166 | static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t *ubuf) | 166 | static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t __user *ubuf) |
167 | { | 167 | { |
168 | int err = 0; | 168 | int err = 0; |
169 | unsigned long sig[4]; | 169 | unsigned long sig[4]; |
@@ -195,10 +195,10 @@ save_static_function(sys32_sigsuspend); | |||
195 | __attribute_used__ noinline static int | 195 | __attribute_used__ noinline static int |
196 | _sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) | 196 | _sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) |
197 | { | 197 | { |
198 | compat_sigset_t *uset; | 198 | compat_sigset_t __user *uset; |
199 | sigset_t newset; | 199 | sigset_t newset; |
200 | 200 | ||
201 | uset = (compat_sigset_t *) regs.regs[4]; | 201 | uset = (compat_sigset_t __user *) regs.regs[4]; |
202 | if (get_sigset(&newset, uset)) | 202 | if (get_sigset(&newset, uset)) |
203 | return -EFAULT; | 203 | return -EFAULT; |
204 | sigdelsetmask(&newset, ~_BLOCKABLE); | 204 | sigdelsetmask(&newset, ~_BLOCKABLE); |
@@ -219,7 +219,7 @@ save_static_function(sys32_rt_sigsuspend); | |||
219 | __attribute_used__ noinline static int | 219 | __attribute_used__ noinline static int |
220 | _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | 220 | _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) |
221 | { | 221 | { |
222 | compat_sigset_t *uset; | 222 | compat_sigset_t __user *uset; |
223 | sigset_t newset; | 223 | sigset_t newset; |
224 | size_t sigsetsize; | 224 | size_t sigsetsize; |
225 | 225 | ||
@@ -228,7 +228,7 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
228 | if (sigsetsize != sizeof(compat_sigset_t)) | 228 | if (sigsetsize != sizeof(compat_sigset_t)) |
229 | return -EINVAL; | 229 | return -EINVAL; |
230 | 230 | ||
231 | uset = (compat_sigset_t *) regs.regs[4]; | 231 | uset = (compat_sigset_t __user *) regs.regs[4]; |
232 | if (get_sigset(&newset, uset)) | 232 | if (get_sigset(&newset, uset)) |
233 | return -EFAULT; | 233 | return -EFAULT; |
234 | sigdelsetmask(&newset, ~_BLOCKABLE); | 234 | sigdelsetmask(&newset, ~_BLOCKABLE); |
@@ -245,8 +245,8 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
245 | return -ERESTARTNOHAND; | 245 | return -ERESTARTNOHAND; |
246 | } | 246 | } |
247 | 247 | ||
248 | asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, | 248 | asmlinkage int sys32_sigaction(int sig, const struct sigaction32 __user *act, |
249 | struct sigaction32 *oact) | 249 | struct sigaction32 __user *oact) |
250 | { | 250 | { |
251 | struct k_sigaction new_ka, old_ka; | 251 | struct k_sigaction new_ka, old_ka; |
252 | int ret; | 252 | int ret; |
@@ -301,7 +301,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) | |||
301 | if (!access_ok(VERIFY_READ, uss, sizeof(*uss))) | 301 | if (!access_ok(VERIFY_READ, uss, sizeof(*uss))) |
302 | return -EFAULT; | 302 | return -EFAULT; |
303 | err |= __get_user(sp, &uss->ss_sp); | 303 | err |= __get_user(sp, &uss->ss_sp); |
304 | kss.ss_sp = (void *) (long) sp; | 304 | kss.ss_sp = (void __user *) (long) sp; |
305 | err |= __get_user(kss.ss_size, &uss->ss_size); | 305 | err |= __get_user(kss.ss_size, &uss->ss_size); |
306 | err |= __get_user(kss.ss_flags, &uss->ss_flags); | 306 | err |= __get_user(kss.ss_flags, &uss->ss_flags); |
307 | if (err) | 307 | if (err) |
@@ -316,7 +316,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) | |||
316 | if (!ret && uoss) { | 316 | if (!ret && uoss) { |
317 | if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss))) | 317 | if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss))) |
318 | return -EFAULT; | 318 | return -EFAULT; |
319 | sp = (int) (long) koss.ss_sp; | 319 | sp = (int) (unsigned long) koss.ss_sp; |
320 | err |= __put_user(sp, &uoss->ss_sp); | 320 | err |= __put_user(sp, &uoss->ss_sp); |
321 | err |= __put_user(koss.ss_size, &uoss->ss_size); | 321 | err |= __put_user(koss.ss_size, &uoss->ss_size); |
322 | err |= __put_user(koss.ss_flags, &uoss->ss_flags); | 322 | err |= __put_user(koss.ss_flags, &uoss->ss_flags); |
@@ -527,7 +527,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
527 | /* The ucontext contains a stack32_t, so we must convert! */ | 527 | /* The ucontext contains a stack32_t, so we must convert! */ |
528 | if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) | 528 | if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) |
529 | goto badframe; | 529 | goto badframe; |
530 | st.ss_sp = (void *)(long) sp; | 530 | st.ss_sp = (void __user *)(long) sp; |
531 | if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) | 531 | if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) |
532 | goto badframe; | 532 | goto badframe; |
533 | if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) | 533 | if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) |
@@ -868,7 +868,7 @@ no_signal: | |||
868 | } | 868 | } |
869 | } | 869 | } |
870 | 870 | ||
871 | asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, | 871 | asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, |
872 | struct sigaction32 __user *oact, | 872 | struct sigaction32 __user *oact, |
873 | unsigned int sigsetsize) | 873 | unsigned int sigsetsize) |
874 | { | 874 | { |
@@ -912,7 +912,7 @@ out: | |||
912 | return ret; | 912 | return ret; |
913 | } | 913 | } |
914 | 914 | ||
915 | asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, | 915 | asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, |
916 | compat_sigset_t __user *oset, unsigned int sigsetsize) | 916 | compat_sigset_t __user *oset, unsigned int sigsetsize) |
917 | { | 917 | { |
918 | sigset_t old_set, new_set; | 918 | sigset_t old_set, new_set; |
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c index 3e168c08a3a8..220e6deb3aa4 100644 --- a/arch/mips/kernel/signal_n32.c +++ b/arch/mips/kernel/signal_n32.c | |||
@@ -141,7 +141,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
141 | /* The ucontext contains a stack32_t, so we must convert! */ | 141 | /* The ucontext contains a stack32_t, so we must convert! */ |
142 | if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) | 142 | if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) |
143 | goto badframe; | 143 | goto badframe; |
144 | st.ss_sp = (void *)(long) sp; | 144 | st.ss_sp = (void __user *)(long) sp; |
145 | if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) | 145 | if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) |
146 | goto badframe; | 146 | goto badframe; |
147 | if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) | 147 | if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) |
diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h index 6fe903e09c62..d8349e4b55ee 100644 --- a/include/asm-mips/signal.h +++ b/include/asm-mips/signal.h | |||
@@ -147,16 +147,34 @@ struct k_sigaction { | |||
147 | 147 | ||
148 | /* IRIX compatible stack_t */ | 148 | /* IRIX compatible stack_t */ |
149 | typedef struct sigaltstack { | 149 | typedef struct sigaltstack { |
150 | void *ss_sp; | 150 | void __user *ss_sp; |
151 | size_t ss_size; | 151 | size_t ss_size; |
152 | int ss_flags; | 152 | int ss_flags; |
153 | } stack_t; | 153 | } stack_t; |
154 | 154 | ||
155 | #ifdef __KERNEL__ | 155 | #ifdef __KERNEL__ |
156 | #include <asm/sigcontext.h> | 156 | #include <asm/sigcontext.h> |
157 | #include <asm/siginfo.h> | ||
157 | 158 | ||
158 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | 159 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) |
159 | 160 | ||
161 | struct pt_regs; | ||
162 | extern void do_signal(struct pt_regs *regs); | ||
163 | extern void do_signal32(struct pt_regs *regs); | ||
164 | |||
165 | extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs, | ||
166 | int signr, sigset_t *set); | ||
167 | extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, | ||
168 | int signr, sigset_t *set, siginfo_t *info); | ||
169 | |||
170 | extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | ||
171 | int signr, sigset_t *set); | ||
172 | extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | ||
173 | int signr, sigset_t *set, siginfo_t *info); | ||
174 | |||
175 | extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs, | ||
176 | int signr, sigset_t *set, siginfo_t *info); | ||
177 | |||
160 | #endif /* __KERNEL__ */ | 178 | #endif /* __KERNEL__ */ |
161 | 179 | ||
162 | #endif /* _ASM_SIGNAL_H */ | 180 | #endif /* _ASM_SIGNAL_H */ |