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>
This commit is contained in:
Shi Weihua 2008-05-23 13:04:59 -07:00 committed by Linus Torvalds
parent f99c90094b
commit 7b26655f62

View file

@ -1652,7 +1652,7 @@ asmlinkage long sys_umask(int mask)
asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
unsigned long arg4, unsigned long arg5) unsigned long arg4, unsigned long arg5)
{ {
long uninitialized_var(error); long error = 0;
if (security_task_prctl(option, arg2, arg3, arg4, arg5, &error)) if (security_task_prctl(option, arg2, arg3, arg4, arg5, &error))
return error; return error;
@ -1701,9 +1701,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
error = PR_TIMING_STATISTICAL; error = PR_TIMING_STATISTICAL;
break; break;
case PR_SET_TIMING: case PR_SET_TIMING:
if (arg2 == PR_TIMING_STATISTICAL) if (arg2 != PR_TIMING_STATISTICAL)
error = 0;
else
error = -EINVAL; error = -EINVAL;
break; break;