Skip to content

Commit

Permalink
[PATCH] selinux: simplify sel_read_bool
Browse files Browse the repository at this point in the history
Simplify sel_read_bool to use the simple_read_from_buffer helper, like the
other selinuxfs functions.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Stephen Smalley authored and Linus Torvalds committed Mar 22, 2006
1 parent bb00307 commit 68bdcf2
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions security/selinux/selinuxfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf,
{
char *page = NULL;
ssize_t length;
ssize_t end;
ssize_t ret;
int cur_enforcing;
struct inode *inode;
Expand Down Expand Up @@ -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,
bool_pending_values[inode->i_ino - BOOL_INO_OFFSET]);
if (length < 0) {
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;
ret = simple_read_from_buffer(buf, count, ppos, page, length);
out:
mutex_unlock(&sel_mutex);
if (page)
Expand Down

0 comments on commit 68bdcf2

Please sign in to comment.