diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-01-18 19:18:37 +0100 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2017-01-25 02:51:11 +0100 |
commit | a45526bb78529911eb6b2525347762e977fce125 (patch) | |
tree | ed0af902e9ca6d867d76449df994fc2e33ac3e85 /arch/mips/kernel/mips-mt-fpaff.c | |
parent | MIPS: Return directly in 32_mmap2() (diff) | |
download | linux-a45526bb78529911eb6b2525347762e977fce125.tar.xz linux-a45526bb78529911eb6b2525347762e977fce125.zip |
MIPS: MT: Move an assignment for the variable "retval" in mipsmt_sys_sched_setaffinity()
A local variable was set to an error code in one case before a concrete
error situation was detected. Thus move the corresponding assignment into
an if branch to indicate a software failure there.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: kernel-janitors@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/15072/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/mips-mt-fpaff.c')
-rw-r--r-- | arch/mips/kernel/mips-mt-fpaff.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c index a12904ea9f65..1a0a3b4ecc3e 100644 --- a/arch/mips/kernel/mips-mt-fpaff.c +++ b/arch/mips/kernel/mips-mt-fpaff.c @@ -99,9 +99,10 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len, retval = -ENOMEM; goto out_free_new_mask; } - retval = -EPERM; - if (!check_same_owner(p) && !capable(CAP_SYS_NICE)) + if (!check_same_owner(p) && !capable(CAP_SYS_NICE)) { + retval = -EPERM; goto out_unlock; + } retval = security_task_setscheduler(p); if (retval) |