aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-10-12 22:38:04 -0400
committerGeert Uytterhoeven <geert@linux-m68k.org>2011-01-07 08:06:59 -0500
commit8972be4d44fbec0b2e1d7b68874fb61c5bf7b06a (patch)
treee3ca0b2e328eb9d40c21ffa96e31523ec0d310a5 /arch/m68knommu/kernel
parenta19185c32dbe975ce1ee86f5fa457f69b1d7f53b (diff)
m68knommu: signal.c __user annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68knommu/kernel')
-rw-r--r--arch/m68knommu/kernel/signal.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c
index 97a471217bba..15ac8205e7ca 100644
--- a/arch/m68knommu/kernel/signal.c
+++ b/arch/m68knommu/kernel/signal.c
@@ -74,9 +74,9 @@ sys_sigsuspend(int unused0, int unused1, old_sigset_t mask)
74 return -ERESTARTNOHAND; 74 return -ERESTARTNOHAND;
75} 75}
76 76
77asmlinkage int 77asmlinkage int
78sys_sigaction(int sig, const struct old_sigaction *act, 78sys_sigaction(int sig, const struct old_sigaction __user *act,
79 struct old_sigaction *oact) 79 struct old_sigaction __user *oact)
80{ 80{
81 struct k_sigaction new_ka, old_ka; 81 struct k_sigaction new_ka, old_ka;
82 int ret; 82 int ret;
@@ -107,7 +107,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
107} 107}
108 108
109asmlinkage int 109asmlinkage int
110sys_sigaltstack(const stack_t *uss, stack_t *uoss) 110sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
111{ 111{
112 return do_sigaltstack(uss, uoss, rdusp()); 112 return do_sigaltstack(uss, uoss, rdusp());
113} 113}
@@ -122,10 +122,10 @@ sys_sigaltstack(const stack_t *uss, stack_t *uoss)
122 122
123struct sigframe 123struct sigframe
124{ 124{
125 char *pretcode; 125 char __user *pretcode;
126 int sig; 126 int sig;
127 int code; 127 int code;
128 struct sigcontext *psc; 128 struct sigcontext __user *psc;
129 char retcode[8]; 129 char retcode[8];
130 unsigned long extramask[_NSIG_WORDS-1]; 130 unsigned long extramask[_NSIG_WORDS-1];
131 struct sigcontext sc; 131 struct sigcontext sc;
@@ -133,10 +133,10 @@ struct sigframe
133 133
134struct rt_sigframe 134struct rt_sigframe
135{ 135{
136 char *pretcode; 136 char __user *pretcode;
137 int sig; 137 int sig;
138 struct siginfo *pinfo; 138 struct siginfo __user *pinfo;
139 void *puc; 139 void __user *puc;
140 char retcode[8]; 140 char retcode[8];
141 struct siginfo info; 141 struct siginfo info;
142 struct ucontext uc; 142 struct ucontext uc;
@@ -183,7 +183,7 @@ out:
183#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4] 183#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4]
184#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1] 184#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1]
185 185
186static inline int rt_restore_fpu_state(struct ucontext *uc) 186static inline int rt_restore_fpu_state(struct ucontext __user *uc)
187{ 187{
188 unsigned char fpstate[FPCONTEXT_SIZE]; 188 unsigned char fpstate[FPCONTEXT_SIZE];
189 int context_size = 0; 189 int context_size = 0;
@@ -202,7 +202,7 @@ static inline int rt_restore_fpu_state(struct ucontext *uc)
202 return 0; 202 return 0;
203 } 203 }
204 204
205 if (__get_user(*(long *)fpstate, (long *)&uc->uc_fpstate)) 205 if (__get_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate))
206 goto out; 206 goto out;
207 if (fpstate[0]) { 207 if (fpstate[0]) {
208 context_size = fpstate[1]; 208 context_size = fpstate[1];
@@ -222,7 +222,7 @@ static inline int rt_restore_fpu_state(struct ucontext *uc)
222 "m" (*fpregs.f_fpcntl)); 222 "m" (*fpregs.f_fpcntl));
223 } 223 }
224 if (context_size && 224 if (context_size &&
225 __copy_from_user(fpstate + 4, (long *)&uc->uc_fpstate + 1, 225 __copy_from_user(fpstate + 4, (long __user *)&uc->uc_fpstate + 1,
226 context_size)) 226 context_size))
227 goto out; 227 goto out;
228 __asm__ volatile (".chip 68k/68881\n\t" 228 __asm__ volatile (".chip 68k/68881\n\t"
@@ -237,7 +237,7 @@ out:
237#endif 237#endif
238 238
239static inline int 239static inline int
240restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, void *fp, 240restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __user *fp,
241 int *pd0) 241 int *pd0)
242{ 242{
243 int formatvec; 243 int formatvec;
@@ -277,10 +277,10 @@ badframe:
277 277
278static inline int 278static inline int
279rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw, 279rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
280 struct ucontext *uc, int *pd0) 280 struct ucontext __user *uc, int *pd0)
281{ 281{
282 int temp; 282 int temp;
283 greg_t *gregs = uc->uc_mcontext.gregs; 283 greg_t __user *gregs = uc->uc_mcontext.gregs;
284 unsigned long usp; 284 unsigned long usp;
285 int err; 285 int err;
286 286
@@ -330,7 +330,7 @@ asmlinkage int do_sigreturn(unsigned long __unused)
330 struct switch_stack *sw = (struct switch_stack *) &__unused; 330 struct switch_stack *sw = (struct switch_stack *) &__unused;
331 struct pt_regs *regs = (struct pt_regs *) (sw + 1); 331 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
332 unsigned long usp = rdusp(); 332 unsigned long usp = rdusp();
333 struct sigframe *frame = (struct sigframe *)(usp - 4); 333 struct sigframe __user *frame = (struct sigframe __user *)(usp - 4);
334 sigset_t set; 334 sigset_t set;
335 int d0; 335 int d0;
336 336
@@ -362,7 +362,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused)
362 struct switch_stack *sw = (struct switch_stack *) &__unused; 362 struct switch_stack *sw = (struct switch_stack *) &__unused;
363 struct pt_regs *regs = (struct pt_regs *) (sw + 1); 363 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
364 unsigned long usp = rdusp(); 364 unsigned long usp = rdusp();
365 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4); 365 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4);
366 sigset_t set; 366 sigset_t set;
367 int d0; 367 int d0;
368 368
@@ -418,7 +418,7 @@ static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs)
418 } 418 }
419} 419}
420 420
421static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs) 421static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs)
422{ 422{
423 unsigned char fpstate[FPCONTEXT_SIZE]; 423 unsigned char fpstate[FPCONTEXT_SIZE];
424 int context_size = 0; 424 int context_size = 0;
@@ -439,7 +439,7 @@ static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
439 ".chip 68k" 439 ".chip 68k"
440 : : "m" (*fpstate) : "memory"); 440 : : "m" (*fpstate) : "memory");
441 441
442 err |= __put_user(*(long *)fpstate, (long *)&uc->uc_fpstate); 442 err |= __put_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate);
443 if (fpstate[0]) { 443 if (fpstate[0]) {
444 fpregset_t fpregs; 444 fpregset_t fpregs;
445 context_size = fpstate[1]; 445 context_size = fpstate[1];
@@ -456,7 +456,7 @@ static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
456 sizeof(fpregs)); 456 sizeof(fpregs));
457 } 457 }
458 if (context_size) 458 if (context_size)
459 err |= copy_to_user((long *)&uc->uc_fpstate + 1, fpstate + 4, 459 err |= copy_to_user((long __user *)&uc->uc_fpstate + 1, fpstate + 4,
460 context_size); 460 context_size);
461 return err; 461 return err;
462} 462}
@@ -481,10 +481,10 @@ static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
481#endif 481#endif
482} 482}
483 483
484static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) 484static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs)
485{ 485{
486 struct switch_stack *sw = (struct switch_stack *)regs - 1; 486 struct switch_stack *sw = (struct switch_stack *)regs - 1;
487 greg_t *gregs = uc->uc_mcontext.gregs; 487 greg_t __user *gregs = uc->uc_mcontext.gregs;
488 int err = 0; 488 int err = 0;
489 489
490 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version); 490 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
@@ -512,7 +512,7 @@ static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs)
512 return err; 512 return err;
513} 513}
514 514
515static inline void * 515static inline void __user *
516get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 516get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
517{ 517{
518 unsigned long usp; 518 unsigned long usp;
@@ -525,13 +525,13 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
525 if (!sas_ss_flags(usp)) 525 if (!sas_ss_flags(usp))
526 usp = current->sas_ss_sp + current->sas_ss_size; 526 usp = current->sas_ss_sp + current->sas_ss_size;
527 } 527 }
528 return (void *)((usp - frame_size) & -8UL); 528 return (void __user *)((usp - frame_size) & -8UL);
529} 529}
530 530
531static int setup_frame (int sig, struct k_sigaction *ka, 531static int setup_frame (int sig, struct k_sigaction *ka,
532 sigset_t *set, struct pt_regs *regs) 532 sigset_t *set, struct pt_regs *regs)
533{ 533{
534 struct sigframe *frame; 534 struct sigframe __user *frame;
535 struct sigcontext context; 535 struct sigcontext context;
536 int err = 0; 536 int err = 0;
537 537
@@ -592,7 +592,7 @@ give_sigsegv:
592static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info, 592static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
593 sigset_t *set, struct pt_regs *regs) 593 sigset_t *set, struct pt_regs *regs)
594{ 594{
595 struct rt_sigframe *frame; 595 struct rt_sigframe __user *frame;
596 int err = 0; 596 int err = 0;
597 597
598 frame = get_sigframe(ka, regs, sizeof(*frame)); 598 frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -609,8 +609,8 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
609 609
610 /* Create the ucontext. */ 610 /* Create the ucontext. */
611 err |= __put_user(0, &frame->uc.uc_flags); 611 err |= __put_user(0, &frame->uc.uc_flags);
612 err |= __put_user(0, &frame->uc.uc_link); 612 err |= __put_user(NULL, &frame->uc.uc_link);
613 err |= __put_user((void *)current->sas_ss_sp, 613 err |= __put_user((void __user *)current->sas_ss_sp,
614 &frame->uc.uc_stack.ss_sp); 614 &frame->uc.uc_stack.ss_sp);
615 err |= __put_user(sas_ss_flags(rdusp()), 615 err |= __put_user(sas_ss_flags(rdusp()),
616 &frame->uc.uc_stack.ss_flags); 616 &frame->uc.uc_stack.ss_flags);