Commit f1fd75bf authored by Sasikantha babu's avatar Sasikantha babu Committed by Linus Torvalds

prctl: remove redunant assignment of "error" to zero

Just setting the "error" to error number is enough on failure and It
doesn't require to set "error" variable to zero in each switch case,
since it was already initialized with zero.  And also removed return 0
in switch case with break statement
Signed-off-by: default avatarSasikantha babu <sasikanth.v19@gmail.com>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarSerge E. Hallyn <serge@hallyn.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6c4088ac
...@@ -2015,7 +2015,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, ...@@ -2015,7 +2015,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
break; break;
} }
me->pdeath_signal = arg2; me->pdeath_signal = arg2;
error = 0;
break; break;
case PR_GET_PDEATHSIG: case PR_GET_PDEATHSIG:
error = put_user(me->pdeath_signal, (int __user *)arg2); error = put_user(me->pdeath_signal, (int __user *)arg2);
...@@ -2029,7 +2028,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, ...@@ -2029,7 +2028,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
break; break;
} }
set_dumpable(me->mm, arg2); set_dumpable(me->mm, arg2);
error = 0;
break; break;
case PR_SET_UNALIGN: case PR_SET_UNALIGN:
...@@ -2056,10 +2054,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, ...@@ -2056,10 +2054,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
case PR_SET_TIMING: case PR_SET_TIMING:
if (arg2 != PR_TIMING_STATISTICAL) if (arg2 != PR_TIMING_STATISTICAL)
error = -EINVAL; error = -EINVAL;
else
error = 0;
break; break;
case PR_SET_NAME: case PR_SET_NAME:
comm[sizeof(me->comm)-1] = 0; comm[sizeof(me->comm)-1] = 0;
if (strncpy_from_user(comm, (char __user *)arg2, if (strncpy_from_user(comm, (char __user *)arg2,
...@@ -2067,20 +2062,19 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, ...@@ -2067,20 +2062,19 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
return -EFAULT; return -EFAULT;
set_task_comm(me, comm); set_task_comm(me, comm);
proc_comm_connector(me); proc_comm_connector(me);
return 0; break;
case PR_GET_NAME: case PR_GET_NAME:
get_task_comm(comm, me); get_task_comm(comm, me);
if (copy_to_user((char __user *)arg2, comm, if (copy_to_user((char __user *)arg2, comm,
sizeof(comm))) sizeof(comm)))
return -EFAULT; return -EFAULT;
return 0; break;
case PR_GET_ENDIAN: case PR_GET_ENDIAN:
error = GET_ENDIAN(me, arg2); error = GET_ENDIAN(me, arg2);
break; break;
case PR_SET_ENDIAN: case PR_SET_ENDIAN:
error = SET_ENDIAN(me, arg2); error = SET_ENDIAN(me, arg2);
break; break;
case PR_GET_SECCOMP: case PR_GET_SECCOMP:
error = prctl_get_seccomp(); error = prctl_get_seccomp();
break; break;
...@@ -2108,7 +2102,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, ...@@ -2108,7 +2102,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
current->default_timer_slack_ns; current->default_timer_slack_ns;
else else
current->timer_slack_ns = arg2; current->timer_slack_ns = arg2;
error = 0;
break; break;
case PR_MCE_KILL: case PR_MCE_KILL:
if (arg4 | arg5) if (arg4 | arg5)
...@@ -2134,7 +2127,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, ...@@ -2134,7 +2127,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
default: default:
return -EINVAL; return -EINVAL;
} }
error = 0;
break; break;
case PR_MCE_KILL_GET: case PR_MCE_KILL_GET:
if (arg2 | arg3 | arg4 | arg5) if (arg2 | arg3 | arg4 | arg5)
...@@ -2153,7 +2145,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, ...@@ -2153,7 +2145,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
break; break;
case PR_SET_CHILD_SUBREAPER: case PR_SET_CHILD_SUBREAPER:
me->signal->is_child_subreaper = !!arg2; me->signal->is_child_subreaper = !!arg2;
error = 0;
break; break;
case PR_GET_CHILD_SUBREAPER: case PR_GET_CHILD_SUBREAPER:
error = put_user(me->signal->is_child_subreaper, error = put_user(me->signal->is_child_subreaper,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment