Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707255 > unrolled thread

[PATCH] cgroup: remove unneeded checks

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2017-08-09 12:30 +0200
Last post2017-08-11 19:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] cgroup: remove unneeded checks Dan Carpenter <dan.carpenter@oracle.com> - 2017-08-09 12:30 +0200
    Re: [PATCH] cgroup: remove unneeded checks Tejun Heo <tj@kernel.org> - 2017-08-11 19:40 +0200

#1707255 — [PATCH] cgroup: remove unneeded checks

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-08-09 12:30 +0200
Subject[PATCH] cgroup: remove unneeded checks
Message-ID<ucwpr-5Qr-9@gated-at.bofh.it>
"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);

[toc] | [next] | [standalone]


#1709884

FromTejun Heo <tj@kernel.org>
Date2017-08-11 19:40 +0200
Message-ID<udm4G-6pu-19@gated-at.bofh.it>
In reply to#1707255
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web