Skip to content

Commit f1fd75b

Browse files
Sasikantha babutorvalds
authored andcommitted
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: Sasikantha babu <sasikanth.v19@gmail.com> Acked-by: Kees Cook <keescook@chromium.org> Acked-by: Serge E. Hallyn <serge@hallyn.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6c4088a commit f1fd75b

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

‎kernel/sys.c‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
20152015
break;
20162016
}
20172017
me->pdeath_signal = arg2;
2018-
error = 0;
20192018
break;
20202019
case PR_GET_PDEATHSIG:
20212020
error = put_user(me->pdeath_signal, (int __user *)arg2);
@@ -2029,7 +2028,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
20292028
break;
20302029
}
20312030
set_dumpable(me->mm, arg2);
2032-
error = 0;
20332031
break;
20342032

20352033
case PR_SET_UNALIGN:
@@ -2056,31 +2054,27 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
20562054
case PR_SET_TIMING:
20572055
if (arg2 != PR_TIMING_STATISTICAL)
20582056
error = -EINVAL;
2059-
else
2060-
error = 0;
20612057
break;
2062-
20632058
case PR_SET_NAME:
20642059
comm[sizeof(me->comm)-1] = 0;
20652060
if (strncpy_from_user(comm, (char __user *)arg2,
20662061
sizeof(me->comm) - 1) < 0)
20672062
return -EFAULT;
20682063
set_task_comm(me, comm);
20692064
proc_comm_connector(me);
2070-
return 0;
2065+
break;
20712066
case PR_GET_NAME:
20722067
get_task_comm(comm, me);
20732068
if (copy_to_user((char __user *)arg2, comm,
20742069
sizeof(comm)))
20752070
return -EFAULT;
2076-
return 0;
2071+
break;
20772072
case PR_GET_ENDIAN:
20782073
error = GET_ENDIAN(me, arg2);
20792074
break;
20802075
case PR_SET_ENDIAN:
20812076
error = SET_ENDIAN(me, arg2);
20822077
break;
2083-
20842078
case PR_GET_SECCOMP:
20852079
error = prctl_get_seccomp();
20862080
break;
@@ -2108,7 +2102,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
21082102
current->default_timer_slack_ns;
21092103
else
21102104
current->timer_slack_ns = arg2;
2111-
error = 0;
21122105
break;
21132106
case PR_MCE_KILL:
21142107
if (arg4 | arg5)
@@ -2134,7 +2127,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
21342127
default:
21352128
return -EINVAL;
21362129
}
2137-
error = 0;
21382130
break;
21392131
case PR_MCE_KILL_GET:
21402132
if (arg2 | arg3 | arg4 | arg5)
@@ -2153,7 +2145,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
21532145
break;
21542146
case PR_SET_CHILD_SUBREAPER:
21552147
me->signal->is_child_subreaper = !!arg2;
2156-
error = 0;
21572148
break;
21582149
case PR_GET_CHILD_SUBREAPER:
21592150
error = put_user(me->signal->is_child_subreaper,

0 commit comments

Comments
 (0)