From: Stephen Smalley Simplify sel_read_bool to use the simple_read_from_buffer helper, like the other selinuxfs functions. Signed-off-by: Stephen Smalley Acked-by: James Morris Signed-off-by: Andrew Morton --- security/selinux/selinuxfs.c | 20 +------------------- 1 files changed, 1 insertion(+), 19 deletions(-) diff -puN security/selinux/selinuxfs.c~selinux-simplify-sel_read_bool security/selinux/selinuxfs.c --- devel/security/selinux/selinuxfs.c~selinux-simplify-sel_read_bool 2006-02-27 20:57:58.000000000 -0800 +++ devel-akpm/security/selinux/selinuxfs.c 2006-02-27 20:57:58.000000000 -0800 @@ -710,7 +710,6 @@ static ssize_t sel_read_bool(struct file { char *page = NULL; ssize_t length; - ssize_t end; ssize_t ret; int cur_enforcing; struct inode *inode; @@ -741,24 +740,7 @@ static ssize_t sel_read_bool(struct file 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) _