[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 11 Nov 2016 14:18:40 +0530
From: Shailendra Verma <shailendra.v@...sung.com>
To: Paul Moore <paul@...l-moore.com>,
Stephen Smalley <sds@...ho.nsa.gov>,
Eric Paris <eparis@...isplace.org>,
James Morris <james.l.morris@...cle.com>,
"Serge E. Hallyn" <serge@...lyn.com>, selinux@...ho.nsa.gov,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org,
Shailendra Verma <shailendra.v@...sung.com>,
Shailendra Verma <shailendra.capricorn@...il.com>
Cc: vidushi.koul@...sung.com
Subject: [PATCH] Security: selinux - Improvement in code readability when
From: "Shailendra Verma" <shailendra.v@...sung.com>
There is no need to call kfree() if memdup_user() fails, as no memory
was allocated and the error in the error-valued pointer should be returned.
Signed-off-by: Shailendra Verma <shailendra.v@...sung.com>
---
security/selinux/selinuxfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 72c145d..b6d0a23 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1166,7 +1166,7 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf,
length = -EINVAL;
if (sscanf(page, "%d", &new_value) != 1)
- goto out;
+ goto out1;
if (new_value)
new_value = 1;
@@ -1174,9 +1174,10 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf,
bool_pending_values[index] = new_value;
length = count;
+out1:
+ kfree(page);
out:
mutex_unlock(&sel_mutex);
- kfree(page);
return length;
}
--
1.7.9.5
Powered by blists - more mailing lists