Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1562062 > unrolled thread

[PATCH 2/3] MIPS: MT: Move an assignment for the variable "retval" in mipsmt_sys_sched_setaffinity()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-01-18 20:00 +0100
Last post2017-01-18 20:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] MIPS: MT: Move an assignment for the variable "retval" in  mipsmt_sys_sched_setaffinity() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-18 20:00 +0100

#1562062 — [PATCH 2/3] MIPS: MT: Move an assignment for the variable "retval" in mipsmt_sys_sched_setaffinity()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-01-18 20:00 +0100
Subject[PATCH 2/3] MIPS: MT: Move an assignment for the variable "retval" in mipsmt_sys_sched_setaffinity()
Message-ID<t13CF-7H3-5@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Jan 2017 19:18:37 +0100

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>
---
 arch/mips/kernel/mips-mt-fpaff.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index 789d7bf4fef3..ddde22787287 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)
-- 
2.11.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web