diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-01-31 11:41:09 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-02-07 08:30:25 -0500 |
commit | 9bbf28a36cae08817ac3a3f98fde329b02c89f4a (patch) | |
tree | c040508718623f0d2fb158352dd3130da4223fc7 /arch/mips/kernel/signal32.c | |
parent | 5be0f654a9d14c0c5aa031a3396ea8b9f2162cb9 (diff) |
[MIPS] Sparse: Add some __user tags to signal functions.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/signal32.c')
-rw-r--r-- | arch/mips/kernel/signal32.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 98b185bbc947..7c2241e4d779 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -144,7 +144,7 @@ struct ucontext32 { | |||
144 | extern void __put_sigset_unknown_nsig(void); | 144 | extern void __put_sigset_unknown_nsig(void); |
145 | extern void __get_sigset_unknown_nsig(void); | 145 | extern void __get_sigset_unknown_nsig(void); |
146 | 146 | ||
147 | static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t *ubuf) | 147 | static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf) |
148 | { | 148 | { |
149 | int err = 0; | 149 | int err = 0; |
150 | 150 | ||
@@ -269,7 +269,7 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, | |||
269 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) | 269 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) |
270 | return -EFAULT; | 270 | return -EFAULT; |
271 | err |= __get_user(handler, &act->sa_handler); | 271 | err |= __get_user(handler, &act->sa_handler); |
272 | new_ka.sa.sa_handler = (void*)(s64)handler; | 272 | new_ka.sa.sa_handler = (void __user *)(s64)handler; |
273 | err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); | 273 | err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); |
274 | err |= __get_user(mask, &act->sa_mask.sig[0]); | 274 | err |= __get_user(mask, &act->sa_mask.sig[0]); |
275 | if (err) | 275 | if (err) |
@@ -299,8 +299,8 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, | |||
299 | 299 | ||
300 | asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) | 300 | asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) |
301 | { | 301 | { |
302 | const stack32_t *uss = (const stack32_t *) regs.regs[4]; | 302 | const stack32_t __user *uss = (const stack32_t __user *) regs.regs[4]; |
303 | stack32_t *uoss = (stack32_t *) regs.regs[5]; | 303 | stack32_t __user *uoss = (stack32_t __user *) regs.regs[5]; |
304 | unsigned long usp = regs.regs[29]; | 304 | unsigned long usp = regs.regs[29]; |
305 | stack_t kss, koss; | 305 | stack_t kss, koss; |
306 | int ret, err = 0; | 306 | int ret, err = 0; |
@@ -319,7 +319,8 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) | |||
319 | } | 319 | } |
320 | 320 | ||
321 | set_fs (KERNEL_DS); | 321 | set_fs (KERNEL_DS); |
322 | ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, usp); | 322 | ret = do_sigaltstack(uss ? (stack_t __user *)&kss : NULL, |
323 | uoss ? (stack_t __user *)&koss : NULL, usp); | ||
323 | set_fs (old_fs); | 324 | set_fs (old_fs); |
324 | 325 | ||
325 | if (!ret && uoss) { | 326 | if (!ret && uoss) { |
@@ -335,7 +336,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) | |||
335 | return ret; | 336 | return ret; |
336 | } | 337 | } |
337 | 338 | ||
338 | static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 *sc) | 339 | static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 __user *sc) |
339 | { | 340 | { |
340 | u32 used_math; | 341 | u32 used_math; |
341 | int err = 0; | 342 | int err = 0; |
@@ -420,7 +421,7 @@ struct rt_sigframe32 { | |||
420 | #endif | 421 | #endif |
421 | }; | 422 | }; |
422 | 423 | ||
423 | int copy_siginfo_to_user32(compat_siginfo_t *to, siginfo_t *from) | 424 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) |
424 | { | 425 | { |
425 | int err; | 426 | int err; |
426 | 427 | ||
@@ -476,10 +477,10 @@ save_static_function(sys32_sigreturn); | |||
476 | __attribute_used__ noinline static void | 477 | __attribute_used__ noinline static void |
477 | _sys32_sigreturn(nabi_no_regargs struct pt_regs regs) | 478 | _sys32_sigreturn(nabi_no_regargs struct pt_regs regs) |
478 | { | 479 | { |
479 | struct sigframe *frame; | 480 | struct sigframe __user *frame; |
480 | sigset_t blocked; | 481 | sigset_t blocked; |
481 | 482 | ||
482 | frame = (struct sigframe *) regs.regs[29]; | 483 | frame = (struct sigframe __user *) regs.regs[29]; |
483 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 484 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
484 | goto badframe; | 485 | goto badframe; |
485 | if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) | 486 | if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) |
@@ -512,13 +513,13 @@ save_static_function(sys32_rt_sigreturn); | |||
512 | __attribute_used__ noinline static void | 513 | __attribute_used__ noinline static void |
513 | _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | 514 | _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) |
514 | { | 515 | { |
515 | struct rt_sigframe32 *frame; | 516 | struct rt_sigframe32 __user *frame; |
516 | mm_segment_t old_fs; | 517 | mm_segment_t old_fs; |
517 | sigset_t set; | 518 | sigset_t set; |
518 | stack_t st; | 519 | stack_t st; |
519 | s32 sp; | 520 | s32 sp; |
520 | 521 | ||
521 | frame = (struct rt_sigframe32 *) regs.regs[29]; | 522 | frame = (struct rt_sigframe32 __user *) regs.regs[29]; |
522 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 523 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
523 | goto badframe; | 524 | goto badframe; |
524 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) | 525 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) |
@@ -546,7 +547,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
546 | call it and ignore errors. */ | 547 | call it and ignore errors. */ |
547 | old_fs = get_fs(); | 548 | old_fs = get_fs(); |
548 | set_fs (KERNEL_DS); | 549 | set_fs (KERNEL_DS); |
549 | do_sigaltstack(&st, NULL, regs.regs[29]); | 550 | do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); |
550 | set_fs (old_fs); | 551 | set_fs (old_fs); |
551 | 552 | ||
552 | /* | 553 | /* |
@@ -564,7 +565,7 @@ badframe: | |||
564 | } | 565 | } |
565 | 566 | ||
566 | static inline int setup_sigcontext32(struct pt_regs *regs, | 567 | static inline int setup_sigcontext32(struct pt_regs *regs, |
567 | struct sigcontext32 *sc) | 568 | struct sigcontext32 __user *sc) |
568 | { | 569 | { |
569 | int err = 0; | 570 | int err = 0; |
570 | 571 | ||
@@ -623,8 +624,9 @@ out: | |||
623 | /* | 624 | /* |
624 | * Determine which stack to use.. | 625 | * Determine which stack to use.. |
625 | */ | 626 | */ |
626 | static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | 627 | static inline void __user *get_sigframe(struct k_sigaction *ka, |
627 | size_t frame_size) | 628 | struct pt_regs *regs, |
629 | size_t frame_size) | ||
628 | { | 630 | { |
629 | unsigned long sp; | 631 | unsigned long sp; |
630 | 632 | ||
@@ -642,13 +644,13 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | |||
642 | if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) | 644 | if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) |
643 | sp = current->sas_ss_sp + current->sas_ss_size; | 645 | sp = current->sas_ss_sp + current->sas_ss_size; |
644 | 646 | ||
645 | return (void *)((sp - frame_size) & ALMASK); | 647 | return (void __user *)((sp - frame_size) & ALMASK); |
646 | } | 648 | } |
647 | 649 | ||
648 | int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | 650 | int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, |
649 | int signr, sigset_t *set) | 651 | int signr, sigset_t *set) |
650 | { | 652 | { |
651 | struct sigframe *frame; | 653 | struct sigframe __user *frame; |
652 | int err = 0; | 654 | int err = 0; |
653 | 655 | ||
654 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 656 | frame = get_sigframe(ka, regs, sizeof(*frame)); |
@@ -702,7 +704,7 @@ give_sigsegv: | |||
702 | int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | 704 | int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, |
703 | int signr, sigset_t *set, siginfo_t *info) | 705 | int signr, sigset_t *set, siginfo_t *info) |
704 | { | 706 | { |
705 | struct rt_sigframe32 *frame; | 707 | struct rt_sigframe32 __user *frame; |
706 | int err = 0; | 708 | int err = 0; |
707 | s32 sp; | 709 | s32 sp; |
708 | 710 | ||
@@ -855,7 +857,7 @@ no_signal: | |||
855 | } | 857 | } |
856 | 858 | ||
857 | asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, | 859 | asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, |
858 | struct sigaction32 *oact, | 860 | struct sigaction32 __user *oact, |
859 | unsigned int sigsetsize) | 861 | unsigned int sigsetsize) |
860 | { | 862 | { |
861 | struct k_sigaction new_sa, old_sa; | 863 | struct k_sigaction new_sa, old_sa; |
@@ -872,7 +874,7 @@ asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, | |||
872 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) | 874 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) |
873 | return -EFAULT; | 875 | return -EFAULT; |
874 | err |= __get_user(handler, &act->sa_handler); | 876 | err |= __get_user(handler, &act->sa_handler); |
875 | new_sa.sa.sa_handler = (void*)(s64)handler; | 877 | new_sa.sa.sa_handler = (void __user *)(s64)handler; |
876 | err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags); | 878 | err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags); |
877 | err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask); | 879 | err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask); |
878 | if (err) | 880 | if (err) |
@@ -899,7 +901,7 @@ out: | |||
899 | } | 901 | } |
900 | 902 | ||
901 | asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, | 903 | asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, |
902 | compat_sigset_t *oset, unsigned int sigsetsize) | 904 | compat_sigset_t __user *oset, unsigned int sigsetsize) |
903 | { | 905 | { |
904 | sigset_t old_set, new_set; | 906 | sigset_t old_set, new_set; |
905 | int ret; | 907 | int ret; |
@@ -909,8 +911,9 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, | |||
909 | return -EFAULT; | 911 | return -EFAULT; |
910 | 912 | ||
911 | set_fs (KERNEL_DS); | 913 | set_fs (KERNEL_DS); |
912 | ret = sys_rt_sigprocmask(how, set ? &new_set : NULL, | 914 | ret = sys_rt_sigprocmask(how, set ? (sigset_t __user *)&new_set : NULL, |
913 | oset ? &old_set : NULL, sigsetsize); | 915 | oset ? (sigset_t __user *)&old_set : NULL, |
916 | sigsetsize); | ||
914 | set_fs (old_fs); | 917 | set_fs (old_fs); |
915 | 918 | ||
916 | if (!ret && oset && put_sigset(&old_set, oset)) | 919 | if (!ret && oset && put_sigset(&old_set, oset)) |
@@ -919,7 +922,7 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, | |||
919 | return ret; | 922 | return ret; |
920 | } | 923 | } |
921 | 924 | ||
922 | asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, | 925 | asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset, |
923 | unsigned int sigsetsize) | 926 | unsigned int sigsetsize) |
924 | { | 927 | { |
925 | int ret; | 928 | int ret; |
@@ -927,7 +930,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, | |||
927 | mm_segment_t old_fs = get_fs(); | 930 | mm_segment_t old_fs = get_fs(); |
928 | 931 | ||
929 | set_fs (KERNEL_DS); | 932 | set_fs (KERNEL_DS); |
930 | ret = sys_rt_sigpending(&set, sigsetsize); | 933 | ret = sys_rt_sigpending((sigset_t __user *)&set, sigsetsize); |
931 | set_fs (old_fs); | 934 | set_fs (old_fs); |
932 | 935 | ||
933 | if (!ret && put_sigset(&set, uset)) | 936 | if (!ret && put_sigset(&set, uset)) |
@@ -936,7 +939,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, | |||
936 | return ret; | 939 | return ret; |
937 | } | 940 | } |
938 | 941 | ||
939 | asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo) | 942 | asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo) |
940 | { | 943 | { |
941 | siginfo_t info; | 944 | siginfo_t info; |
942 | int ret; | 945 | int ret; |
@@ -946,7 +949,7 @@ asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo) | |||
946 | copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE)) | 949 | copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE)) |
947 | return -EFAULT; | 950 | return -EFAULT; |
948 | set_fs (KERNEL_DS); | 951 | set_fs (KERNEL_DS); |
949 | ret = sys_rt_sigqueueinfo(pid, sig, &info); | 952 | ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info); |
950 | set_fs (old_fs); | 953 | set_fs (old_fs); |
951 | return ret; | 954 | return ret; |
952 | } | 955 | } |