Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bfd51626 authored by Davi Arnaut's avatar Davi Arnaut Committed by Linus Torvalds
Browse files

[PATCH] SELinux: remove unecessary size_t checks in selinuxfs



This patch removes a bunch of unecessary checks for (size_t < 0) in
selinuxfs.

Signed-off-by: default avatarJames Morris <jmorris@namei.org>
Acked-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ce4c2bd1
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -105,7 +105,7 @@ static ssize_t sel_write_enforce(struct file * file, const char __user * buf,
	ssize_t length;
	ssize_t length;
	int new_value;
	int new_value;


	if (count < 0 || count >= PAGE_SIZE)
	if (count >= PAGE_SIZE)
		return -ENOMEM;
		return -ENOMEM;
	if (*ppos != 0) {
	if (*ppos != 0) {
		/* No partial writes. */
		/* No partial writes. */
@@ -155,7 +155,7 @@ static ssize_t sel_write_disable(struct file * file, const char __user * buf,
	int new_value;
	int new_value;
	extern int selinux_disable(void);
	extern int selinux_disable(void);


	if (count < 0 || count >= PAGE_SIZE)
	if (count >= PAGE_SIZE)
		return -ENOMEM;
		return -ENOMEM;
	if (*ppos != 0) {
	if (*ppos != 0) {
		/* No partial writes. */
		/* No partial writes. */
@@ -242,7 +242,7 @@ static ssize_t sel_write_load(struct file * file, const char __user * buf,
		goto out;
		goto out;
	}
	}


	if ((count < 0) || (count > 64 * 1024 * 1024)
	if ((count > 64 * 1024 * 1024)
	    || (data = vmalloc(count)) == NULL) {
	    || (data = vmalloc(count)) == NULL) {
		length = -ENOMEM;
		length = -ENOMEM;
		goto out;
		goto out;
@@ -284,7 +284,7 @@ static ssize_t sel_write_context(struct file * file, const char __user * buf,
	if (length)
	if (length)
		return length;
		return length;


	if (count < 0 || count >= PAGE_SIZE)
	if (count >= PAGE_SIZE)
		return -ENOMEM;
		return -ENOMEM;
	if (*ppos != 0) {
	if (*ppos != 0) {
		/* No partial writes. */
		/* No partial writes. */
@@ -332,7 +332,7 @@ static ssize_t sel_write_checkreqprot(struct file * file, const char __user * bu
	if (length)
	if (length)
		return length;
		return length;


	if (count < 0 || count >= PAGE_SIZE)
	if (count >= PAGE_SIZE)
		return -ENOMEM;
		return -ENOMEM;
	if (*ppos != 0) {
	if (*ppos != 0) {
		/* No partial writes. */
		/* No partial writes. */
@@ -729,7 +729,7 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf,
	if (!filep->f_op)
	if (!filep->f_op)
		goto out;
		goto out;


	if (count < 0 || count > PAGE_SIZE) {
	if (count > PAGE_SIZE) {
		ret = -EINVAL;
		ret = -EINVAL;
		goto out;
		goto out;
	}
	}
@@ -790,7 +790,7 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf,
	if (!filep->f_op)
	if (!filep->f_op)
		goto out;
		goto out;


	if (count < 0 || count >= PAGE_SIZE) {
	if (count >= PAGE_SIZE) {
		length = -ENOMEM;
		length = -ENOMEM;
		goto out;
		goto out;
	}
	}
@@ -848,7 +848,7 @@ static ssize_t sel_commit_bools_write(struct file *filep,
	if (!filep->f_op)
	if (!filep->f_op)
		goto out;
		goto out;


	if (count < 0 || count >= PAGE_SIZE) {
	if (count >= PAGE_SIZE) {
		length = -ENOMEM;
		length = -ENOMEM;
		goto out;
		goto out;
	}
	}
@@ -1022,7 +1022,7 @@ static ssize_t sel_write_avc_cache_threshold(struct file * file,
	ssize_t ret;
	ssize_t ret;
	int new_value;
	int new_value;


	if (count < 0 || count >= PAGE_SIZE) {
	if (count >= PAGE_SIZE) {
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto out;
		goto out;
	}
	}