aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2011-04-28 05:36:20 -0400
committerOleg Nesterov <oleg@redhat.com>2011-04-28 07:01:40 -0400
commitb013c399245a88a73aaa031279f0c4d7cea7fe68 (patch)
treea008708eee3d659e4f416fdf56894d572ae798b8 /kernel/signal.c
parent702a5073fdb71eb29cd4912575289fb5044c1894 (diff)
signal: cleanup sys_sigprocmask()
Cleanup. Remove the unneeded goto's, we can simply read blocked.sig[0] unconditionally and then copy-to-user it if oset != NULL. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Tejun Heo <tj@kernel.org> Reviewed-by: Matt Fleming <matt.fleming@linux.intel.com>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index e7ee4e642c5a..c0af959b8530 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2889,29 +2889,28 @@ SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
2889/** 2889/**
2890 * sys_sigprocmask - examine and change blocked signals 2890 * sys_sigprocmask - examine and change blocked signals
2891 * @how: whether to add, remove, or set signals 2891 * @how: whether to add, remove, or set signals
2892 * @set: signals to add or remove (if non-null) 2892 * @nset: signals to add or remove (if non-null)
2893 * @oset: previous value of signal mask if non-null 2893 * @oset: previous value of signal mask if non-null
2894 * 2894 *
2895 * Some platforms have their own version with special arguments; 2895 * Some platforms have their own version with special arguments;
2896 * others support only sys_rt_sigprocmask. 2896 * others support only sys_rt_sigprocmask.
2897 */ 2897 */
2898 2898
2899SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set, 2899SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
2900 old_sigset_t __user *, oset) 2900 old_sigset_t __user *, oset)
2901{ 2901{
2902 int error;
2903 old_sigset_t old_set, new_set; 2902 old_sigset_t old_set, new_set;
2903 int error;
2904 2904
2905 if (set) { 2905 old_set = current->blocked.sig[0];
2906 error = -EFAULT;
2907 if (copy_from_user(&new_set, set, sizeof(*set)))
2908 goto out;
2909 new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP));
2910 2906
2911 spin_lock_irq(&current->sighand->siglock); 2907 if (nset) {
2912 old_set = current->blocked.sig[0]; 2908 if (copy_from_user(&new_set, nset, sizeof(*nset)))
2909 return -EFAULT;
2910 new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP));
2913 2911
2914 error = 0; 2912 error = 0;
2913 spin_lock_irq(&current->sighand->siglock);
2915 switch (how) { 2914 switch (how) {
2916 default: 2915 default:
2917 error = -EINVAL; 2916 error = -EINVAL;
@@ -2930,19 +2929,15 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
2930 recalc_sigpending(); 2929 recalc_sigpending();
2931 spin_unlock_irq(&current->sighand->siglock); 2930 spin_unlock_irq(&current->sighand->siglock);
2932 if (error) 2931 if (error)
2933 goto out; 2932 return error;
2934 if (oset) 2933 }
2935 goto set_old; 2934
2936 } else if (oset) { 2935 if (oset) {
2937 old_set = current->blocked.sig[0];
2938 set_old:
2939 error = -EFAULT;
2940 if (copy_to_user(oset, &old_set, sizeof(*oset))) 2936 if (copy_to_user(oset, &old_set, sizeof(*oset)))
2941 goto out; 2937 return -EFAULT;
2942 } 2938 }
2943 error = 0; 2939
2944out: 2940 return 0;
2945 return error;
2946} 2941}
2947#endif /* __ARCH_WANT_SYS_SIGPROCMASK */ 2942#endif /* __ARCH_WANT_SYS_SIGPROCMASK */
2948 2943