Commit 68bdcf28 authored by Stephen Smalley's avatar Stephen Smalley Committed by Linus Torvalds

[PATCH] selinux: simplify sel_read_bool

Simplify sel_read_bool to use the simple_read_from_buffer helper, like the
other selinuxfs functions.
Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Acked-by: default avatarJames Morris <jmorris@namei.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bb003079
...@@ -710,7 +710,6 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf, ...@@ -710,7 +710,6 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf,
{ {
char *page = NULL; char *page = NULL;
ssize_t length; ssize_t length;
ssize_t end;
ssize_t ret; ssize_t ret;
int cur_enforcing; int cur_enforcing;
struct inode *inode; struct inode *inode;
...@@ -741,24 +740,7 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf, ...@@ -741,24 +740,7 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf,
length = scnprintf(page, PAGE_SIZE, "%d %d", cur_enforcing, length = scnprintf(page, PAGE_SIZE, "%d %d", cur_enforcing,
bool_pending_values[inode->i_ino - BOOL_INO_OFFSET]); bool_pending_values[inode->i_ino - BOOL_INO_OFFSET]);
if (length < 0) { ret = simple_read_from_buffer(buf, count, ppos, page, length);
ret = length;
goto out;
}
if (*ppos >= length) {
ret = 0;
goto out;
}
if (count + *ppos > length)
count = length - *ppos;
end = count + *ppos;
if (copy_to_user(buf, (char *) page + *ppos, count)) {
ret = -EFAULT;
goto out;
}
*ppos = end;
ret = count;
out: out:
mutex_unlock(&sel_mutex); mutex_unlock(&sel_mutex);
if (page) if (page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment