diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2013-02-21 19:43:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 20:22:20 -0500 |
commit | f3cbd435b02fb45efc2c8a39c2ea19816669c412 (patch) | |
tree | fc3cfda8b6bdbddedf0a0d3d41736bf9a049a7d9 | |
parent | 7fe5e04292e71af34ae171b88caa2a139e0b6125 (diff) |
sys_prctl(): coding-style cleanup
Remove a tabstop from the switch statement, in the usual fashion. A few
instances of weirdwrapping were removed as a result.
Cc: Chen Gang <gang.chen@asianux.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/sys.c | 288 |
1 files changed, 143 insertions, 145 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 83261059676c..840cfdad7bfc 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -2013,161 +2013,159 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, | |||
2013 | 2013 | ||
2014 | error = 0; | 2014 | error = 0; |
2015 | switch (option) { | 2015 | switch (option) { |
2016 | case PR_SET_PDEATHSIG: | 2016 | case PR_SET_PDEATHSIG: |
2017 | if (!valid_signal(arg2)) { | 2017 | if (!valid_signal(arg2)) { |
2018 | error = -EINVAL; | 2018 | error = -EINVAL; |
2019 | break; | ||
2020 | } | ||
2021 | me->pdeath_signal = arg2; | ||
2022 | break; | ||
2023 | case PR_GET_PDEATHSIG: | ||
2024 | error = put_user(me->pdeath_signal, (int __user *)arg2); | ||
2025 | break; | ||
2026 | case PR_GET_DUMPABLE: | ||
2027 | error = get_dumpable(me->mm); | ||
2028 | break; | 2019 | break; |
2029 | case PR_SET_DUMPABLE: | 2020 | } |
2030 | if (arg2 != SUID_DUMP_DISABLE && | 2021 | me->pdeath_signal = arg2; |
2031 | arg2 != SUID_DUMP_USER) { | 2022 | break; |
2032 | error = -EINVAL; | 2023 | case PR_GET_PDEATHSIG: |
2033 | break; | 2024 | error = put_user(me->pdeath_signal, (int __user *)arg2); |
2034 | } | 2025 | break; |
2035 | set_dumpable(me->mm, arg2); | 2026 | case PR_GET_DUMPABLE: |
2027 | error = get_dumpable(me->mm); | ||
2028 | break; | ||
2029 | case PR_SET_DUMPABLE: | ||
2030 | if (arg2 != SUID_DUMP_DISABLE && arg2 != SUID_DUMP_USER) { | ||
2031 | error = -EINVAL; | ||
2036 | break; | 2032 | break; |
2033 | } | ||
2034 | set_dumpable(me->mm, arg2); | ||
2035 | break; | ||
2037 | 2036 | ||
2038 | case PR_SET_UNALIGN: | 2037 | case PR_SET_UNALIGN: |
2039 | error = SET_UNALIGN_CTL(me, arg2); | 2038 | error = SET_UNALIGN_CTL(me, arg2); |
2040 | break; | 2039 | break; |
2041 | case PR_GET_UNALIGN: | 2040 | case PR_GET_UNALIGN: |
2042 | error = GET_UNALIGN_CTL(me, arg2); | 2041 | error = GET_UNALIGN_CTL(me, arg2); |
2043 | break; | 2042 | break; |
2044 | case PR_SET_FPEMU: | 2043 | case PR_SET_FPEMU: |
2045 | error = SET_FPEMU_CTL(me, arg2); | 2044 | error = SET_FPEMU_CTL(me, arg2); |
2046 | break; | 2045 | break; |
2047 | case PR_GET_FPEMU: | 2046 | case PR_GET_FPEMU: |
2048 | error = GET_FPEMU_CTL(me, arg2); | 2047 | error = GET_FPEMU_CTL(me, arg2); |
2049 | break; | 2048 | break; |
2050 | case PR_SET_FPEXC: | 2049 | case PR_SET_FPEXC: |
2051 | error = SET_FPEXC_CTL(me, arg2); | 2050 | error = SET_FPEXC_CTL(me, arg2); |
2052 | break; | 2051 | break; |
2053 | case PR_GET_FPEXC: | 2052 | case PR_GET_FPEXC: |
2054 | error = GET_FPEXC_CTL(me, arg2); | 2053 | error = GET_FPEXC_CTL(me, arg2); |
2055 | break; | 2054 | break; |
2056 | case PR_GET_TIMING: | 2055 | case PR_GET_TIMING: |
2057 | error = PR_TIMING_STATISTICAL; | 2056 | error = PR_TIMING_STATISTICAL; |
2058 | break; | 2057 | break; |
2059 | case PR_SET_TIMING: | 2058 | case PR_SET_TIMING: |
2060 | if (arg2 != PR_TIMING_STATISTICAL) | 2059 | if (arg2 != PR_TIMING_STATISTICAL) |
2061 | error = -EINVAL; | 2060 | error = -EINVAL; |
2062 | break; | 2061 | break; |
2063 | case PR_SET_NAME: | 2062 | case PR_SET_NAME: |
2064 | comm[sizeof(me->comm)-1] = 0; | 2063 | comm[sizeof(me->comm) - 1] = 0; |
2065 | if (strncpy_from_user(comm, (char __user *)arg2, | 2064 | if (strncpy_from_user(comm, (char __user *)arg2, |
2066 | sizeof(me->comm) - 1) < 0) | 2065 | sizeof(me->comm) - 1) < 0) |
2067 | return -EFAULT; | 2066 | return -EFAULT; |
2068 | set_task_comm(me, comm); | 2067 | set_task_comm(me, comm); |
2069 | proc_comm_connector(me); | 2068 | proc_comm_connector(me); |
2070 | break; | 2069 | break; |
2071 | case PR_GET_NAME: | 2070 | case PR_GET_NAME: |
2072 | get_task_comm(comm, me); | 2071 | get_task_comm(comm, me); |
2073 | if (copy_to_user((char __user *)arg2, comm, | 2072 | if (copy_to_user((char __user *)arg2, comm, sizeof(comm))) |
2074 | sizeof(comm))) | 2073 | return -EFAULT; |
2075 | return -EFAULT; | 2074 | break; |
2076 | break; | 2075 | case PR_GET_ENDIAN: |
2077 | case PR_GET_ENDIAN: | 2076 | error = GET_ENDIAN(me, arg2); |
2078 | error = GET_ENDIAN(me, arg2); | 2077 | break; |
2079 | break; | 2078 | case PR_SET_ENDIAN: |
2080 | case PR_SET_ENDIAN: | 2079 | error = SET_ENDIAN(me, arg2); |
2081 | error = SET_ENDIAN(me, arg2); | 2080 | break; |
2082 | break; | 2081 | case PR_GET_SECCOMP: |
2083 | case PR_GET_SECCOMP: | 2082 | error = prctl_get_seccomp(); |
2084 | error = prctl_get_seccomp(); | 2083 | break; |
2085 | break; | 2084 | case PR_SET_SECCOMP: |
2086 | case PR_SET_SECCOMP: | 2085 | error = prctl_set_seccomp(arg2, (char __user *)arg3); |
2087 | error = prctl_set_seccomp(arg2, (char __user *)arg3); | 2086 | break; |
2088 | break; | 2087 | case PR_GET_TSC: |
2089 | case PR_GET_TSC: | 2088 | error = GET_TSC_CTL(arg2); |
2090 | error = GET_TSC_CTL(arg2); | 2089 | break; |
2091 | break; | 2090 | case PR_SET_TSC: |
2092 | case PR_SET_TSC: | 2091 | error = SET_TSC_CTL(arg2); |
2093 | error = SET_TSC_CTL(arg2); | 2092 | break; |
2094 | break; | 2093 | case PR_TASK_PERF_EVENTS_DISABLE: |
2095 | case PR_TASK_PERF_EVENTS_DISABLE: | 2094 | error = perf_event_task_disable(); |
2096 | error = perf_event_task_disable(); | 2095 | break; |
2097 | break; | 2096 | case PR_TASK_PERF_EVENTS_ENABLE: |
2098 | case PR_TASK_PERF_EVENTS_ENABLE: | 2097 | error = perf_event_task_enable(); |
2099 | error = perf_event_task_enable(); | 2098 | break; |
2100 | break; | 2099 | case PR_GET_TIMERSLACK: |
2101 | case PR_GET_TIMERSLACK: | 2100 | error = current->timer_slack_ns; |
2102 | error = current->timer_slack_ns; | 2101 | break; |
2103 | break; | 2102 | case PR_SET_TIMERSLACK: |
2104 | case PR_SET_TIMERSLACK: | 2103 | if (arg2 <= 0) |
2105 | if (arg2 <= 0) | 2104 | current->timer_slack_ns = |
2106 | current->timer_slack_ns = | ||
2107 | current->default_timer_slack_ns; | 2105 | current->default_timer_slack_ns; |
2108 | else | 2106 | else |
2109 | current->timer_slack_ns = arg2; | 2107 | current->timer_slack_ns = arg2; |
2110 | break; | 2108 | break; |
2111 | case PR_MCE_KILL: | 2109 | case PR_MCE_KILL: |
2112 | if (arg4 | arg5) | 2110 | if (arg4 | arg5) |
2113 | return -EINVAL; | 2111 | return -EINVAL; |
2114 | switch (arg2) { | 2112 | switch (arg2) { |
2115 | case PR_MCE_KILL_CLEAR: | 2113 | case PR_MCE_KILL_CLEAR: |
2116 | if (arg3 != 0) | 2114 | if (arg3 != 0) |
2117 | return -EINVAL; | ||
2118 | current->flags &= ~PF_MCE_PROCESS; | ||
2119 | break; | ||
2120 | case PR_MCE_KILL_SET: | ||
2121 | current->flags |= PF_MCE_PROCESS; | ||
2122 | if (arg3 == PR_MCE_KILL_EARLY) | ||
2123 | current->flags |= PF_MCE_EARLY; | ||
2124 | else if (arg3 == PR_MCE_KILL_LATE) | ||
2125 | current->flags &= ~PF_MCE_EARLY; | ||
2126 | else if (arg3 == PR_MCE_KILL_DEFAULT) | ||
2127 | current->flags &= | ||
2128 | ~(PF_MCE_EARLY|PF_MCE_PROCESS); | ||
2129 | else | ||
2130 | return -EINVAL; | ||
2131 | break; | ||
2132 | default: | ||
2133 | return -EINVAL; | 2115 | return -EINVAL; |
2134 | } | 2116 | current->flags &= ~PF_MCE_PROCESS; |
2135 | break; | 2117 | break; |
2136 | case PR_MCE_KILL_GET: | 2118 | case PR_MCE_KILL_SET: |
2137 | if (arg2 | arg3 | arg4 | arg5) | 2119 | current->flags |= PF_MCE_PROCESS; |
2138 | return -EINVAL; | 2120 | if (arg3 == PR_MCE_KILL_EARLY) |
2139 | if (current->flags & PF_MCE_PROCESS) | 2121 | current->flags |= PF_MCE_EARLY; |
2140 | error = (current->flags & PF_MCE_EARLY) ? | 2122 | else if (arg3 == PR_MCE_KILL_LATE) |
2141 | PR_MCE_KILL_EARLY : PR_MCE_KILL_LATE; | 2123 | current->flags &= ~PF_MCE_EARLY; |
2124 | else if (arg3 == PR_MCE_KILL_DEFAULT) | ||
2125 | current->flags &= | ||
2126 | ~(PF_MCE_EARLY|PF_MCE_PROCESS); | ||
2142 | else | 2127 | else |
2143 | error = PR_MCE_KILL_DEFAULT; | ||
2144 | break; | ||
2145 | case PR_SET_MM: | ||
2146 | error = prctl_set_mm(arg2, arg3, arg4, arg5); | ||
2147 | break; | ||
2148 | case PR_GET_TID_ADDRESS: | ||
2149 | error = prctl_get_tid_address(me, (int __user **)arg2); | ||
2150 | break; | ||
2151 | case PR_SET_CHILD_SUBREAPER: | ||
2152 | me->signal->is_child_subreaper = !!arg2; | ||
2153 | break; | ||
2154 | case PR_GET_CHILD_SUBREAPER: | ||
2155 | error = put_user(me->signal->is_child_subreaper, | ||
2156 | (int __user *) arg2); | ||
2157 | break; | ||
2158 | case PR_SET_NO_NEW_PRIVS: | ||
2159 | if (arg2 != 1 || arg3 || arg4 || arg5) | ||
2160 | return -EINVAL; | 2128 | return -EINVAL; |
2161 | |||
2162 | current->no_new_privs = 1; | ||
2163 | break; | 2129 | break; |
2164 | case PR_GET_NO_NEW_PRIVS: | ||
2165 | if (arg2 || arg3 || arg4 || arg5) | ||
2166 | return -EINVAL; | ||
2167 | return current->no_new_privs ? 1 : 0; | ||
2168 | default: | 2130 | default: |
2169 | error = -EINVAL; | 2131 | return -EINVAL; |
2170 | break; | 2132 | } |
2133 | break; | ||
2134 | case PR_MCE_KILL_GET: | ||
2135 | if (arg2 | arg3 | arg4 | arg5) | ||
2136 | return -EINVAL; | ||
2137 | if (current->flags & PF_MCE_PROCESS) | ||
2138 | error = (current->flags & PF_MCE_EARLY) ? | ||
2139 | PR_MCE_KILL_EARLY : PR_MCE_KILL_LATE; | ||
2140 | else | ||
2141 | error = PR_MCE_KILL_DEFAULT; | ||
2142 | break; | ||
2143 | case PR_SET_MM: | ||
2144 | error = prctl_set_mm(arg2, arg3, arg4, arg5); | ||
2145 | break; | ||
2146 | case PR_GET_TID_ADDRESS: | ||
2147 | error = prctl_get_tid_address(me, (int __user **)arg2); | ||
2148 | break; | ||
2149 | case PR_SET_CHILD_SUBREAPER: | ||
2150 | me->signal->is_child_subreaper = !!arg2; | ||
2151 | break; | ||
2152 | case PR_GET_CHILD_SUBREAPER: | ||
2153 | error = put_user(me->signal->is_child_subreaper, | ||
2154 | (int __user *)arg2); | ||
2155 | break; | ||
2156 | case PR_SET_NO_NEW_PRIVS: | ||
2157 | if (arg2 != 1 || arg3 || arg4 || arg5) | ||
2158 | return -EINVAL; | ||
2159 | |||
2160 | current->no_new_privs = 1; | ||
2161 | break; | ||
2162 | case PR_GET_NO_NEW_PRIVS: | ||
2163 | if (arg2 || arg3 || arg4 || arg5) | ||
2164 | return -EINVAL; | ||
2165 | return current->no_new_privs ? 1 : 0; | ||
2166 | default: | ||
2167 | error = -EINVAL; | ||
2168 | break; | ||
2171 | } | 2169 | } |
2172 | return error; | 2170 | return error; |
2173 | } | 2171 | } |