public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroup: remove unneeded checks
@ 2017-08-09 10:25 Dan Carpenter
  2017-08-11 17:33 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-08-09 10:25 UTC (permalink / raw)
  To: Tejun Heo, Roman Gushchin; +Cc: Zefan Li, linux-kernel, kernel-janitors

"descendants" and "depth" are declared as int, so they can't be larger
than INT_MAX.  Static checkers complain and it's slightly confusing for
humans as well so let's just remove these conditions.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index bf8a6e2db278..5988781d7128 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -3247,7 +3247,7 @@ static ssize_t cgroup_max_descendants_write(struct kernfs_open_file *of,
 			return ret;
 	}
 
-	if (descendants < 0 || descendants > INT_MAX)
+	if (descendants < 0)
 		return -ERANGE;
 
 	cgrp = cgroup_kn_lock_live(of->kn, false);
@@ -3290,7 +3290,7 @@ static ssize_t cgroup_max_depth_write(struct kernfs_open_file *of,
 			return ret;
 	}
 
-	if (depth < 0 || depth > INT_MAX)
+	if (depth < 0)
 		return -ERANGE;
 
 	cgrp = cgroup_kn_lock_live(of->kn, false);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cgroup: remove unneeded checks
  2017-08-09 10:25 [PATCH] cgroup: remove unneeded checks Dan Carpenter
@ 2017-08-11 17:33 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2017-08-11 17:33 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Roman Gushchin, Zefan Li, linux-kernel, kernel-janitors

On Wed, Aug 09, 2017 at 01:25:21PM +0300, Dan Carpenter wrote:
> "descendants" and "depth" are declared as int, so they can't be larger
> than INT_MAX.  Static checkers complain and it's slightly confusing for
> humans as well so let's just remove these conditions.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to cgroup/for-4.14.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-11 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-09 10:25 [PATCH] cgroup: remove unneeded checks Dan Carpenter
2017-08-11 17:33 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox