diff options
author | Stephen Smalley <sds@tycho.nsa.gov> | 2006-03-22 03:09:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-22 10:54:07 -0500 |
commit | 68bdcf28a8d245208a02dc9caa60fe13cc1b0ea8 (patch) | |
tree | 4d50f43597d677c7b1b88b10696cb2358abaf83e /security/selinux/selinuxfs.c | |
parent | bb0030797f55c9996ea1cebd16b65750ceb7e4fd (diff) |
[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: 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>
Diffstat (limited to 'security/selinux/selinuxfs.c')
-rw-r--r-- | security/selinux/selinuxfs.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 65efa8f76331..cc782083d71f 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -710,7 +710,6 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf, | |||
710 | { | 710 | { |
711 | char *page = NULL; | 711 | char *page = NULL; |
712 | ssize_t length; | 712 | ssize_t length; |
713 | ssize_t end; | ||
714 | ssize_t ret; | 713 | ssize_t ret; |
715 | int cur_enforcing; | 714 | int cur_enforcing; |
716 | struct inode *inode; | 715 | struct inode *inode; |
@@ -741,24 +740,7 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf, | |||
741 | 740 | ||
742 | length = scnprintf(page, PAGE_SIZE, "%d %d", cur_enforcing, | 741 | length = scnprintf(page, PAGE_SIZE, "%d %d", cur_enforcing, |
743 | bool_pending_values[inode->i_ino - BOOL_INO_OFFSET]); | 742 | bool_pending_values[inode->i_ino - BOOL_INO_OFFSET]); |
744 | if (length < 0) { | 743 | ret = simple_read_from_buffer(buf, count, ppos, page, length); |
745 | ret = length; | ||
746 | goto out; | ||
747 | } | ||
748 | |||
749 | if (*ppos >= length) { | ||
750 | ret = 0; | ||
751 | goto out; | ||
752 | } | ||
753 | if (count + *ppos > length) | ||
754 | count = length - *ppos; | ||
755 | end = count + *ppos; | ||
756 | if (copy_to_user(buf, (char *) page + *ppos, count)) { | ||
757 | ret = -EFAULT; | ||
758 | goto out; | ||
759 | } | ||
760 | *ppos = end; | ||
761 | ret = count; | ||
762 | out: | 744 | out: |
763 | mutex_unlock(&sel_mutex); | 745 | mutex_unlock(&sel_mutex); |
764 | if (page) | 746 | if (page) |