[patch 1/1] selinux: simplify sel_read_bool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simplify sel_read_bool to use the simple_read_from_buffer helper,
like the other selinuxfs functions.  Please apply.

Signed-off-by:  Stephen Smalley <[email protected]>
Acked-by: James Morris <[email protected]>

---

 security/selinux/selinuxfs.c |   20 +-------------------
 1 files changed, 1 insertion(+), 19 deletions(-)

Index: linux-2.6/security/selinux/selinuxfs.c
===================================================================
RCS file: /nfshome/pal/CVS/linux-2.6/security/selinux/selinuxfs.c,v
retrieving revision 1.58
diff -u -p -r1.58 selinuxfs.c
--- linux-2.6/security/selinux/selinuxfs.c	3 Jan 2006 16:37:00 -0000	1.58
+++ linux-2.6/security/selinux/selinuxfs.c	3 Feb 2006 19:49:10 -0000
@@ -709,7 +709,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;
@@ -740,24 +739,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:
 	up(&sel_sem);
 	if (page)

-- 
Stephen Smalley
National Security Agency

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux