diff options
| author | Shi Weihua <shiwh@cn.fujitsu.com> | 2008-05-23 16:04:59 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-24 12:56:13 -0400 |
| commit | 7b26655f6208fdefa9ab0adc016116324f8d4ba8 (patch) | |
| tree | 07f081c52da72a9730861c74ebea86ea48d402e2 | |
| parent | f99c90094bffbe1cf38ef66f198a808c14a02d56 (diff) | |
sys_prctl(): fix return of uninitialized value
If none of the switch cases match, the PR_SET_PDEATHSIG and
PR_SET_DUMPABLE cases of the switch statement will never write to local
variable `error'.
Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
Cc: Andrew G. Morgan <morgan@kernel.org>
Acked-by: "Serge E. Hallyn" <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | kernel/sys.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 895d2d4c9493..14e97282eb6c 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -1652,7 +1652,7 @@ asmlinkage long sys_umask(int mask) | |||
| 1652 | asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, | 1652 | asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, |
| 1653 | unsigned long arg4, unsigned long arg5) | 1653 | unsigned long arg4, unsigned long arg5) |
| 1654 | { | 1654 | { |
| 1655 | long uninitialized_var(error); | 1655 | long error = 0; |
| 1656 | 1656 | ||
| 1657 | if (security_task_prctl(option, arg2, arg3, arg4, arg5, &error)) | 1657 | if (security_task_prctl(option, arg2, arg3, arg4, arg5, &error)) |
| 1658 | return error; | 1658 | return error; |
| @@ -1701,9 +1701,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, | |||
| 1701 | error = PR_TIMING_STATISTICAL; | 1701 | error = PR_TIMING_STATISTICAL; |
| 1702 | break; | 1702 | break; |
| 1703 | case PR_SET_TIMING: | 1703 | case PR_SET_TIMING: |
| 1704 | if (arg2 == PR_TIMING_STATISTICAL) | 1704 | if (arg2 != PR_TIMING_STATISTICAL) |
| 1705 | error = 0; | ||
| 1706 | else | ||
| 1707 | error = -EINVAL; | 1705 | error = -EINVAL; |
| 1708 | break; | 1706 | break; |
| 1709 | 1707 | ||
