From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752879AbdHIKZi (ORCPT ); Wed, 9 Aug 2017 06:25:38 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:25490 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbdHIKZg (ORCPT ); Wed, 9 Aug 2017 06:25:36 -0400 Date: Wed, 9 Aug 2017 13:25:21 +0300 From: Dan Carpenter To: Tejun Heo , Roman Gushchin Cc: Zefan Li , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] cgroup: remove unneeded checks Message-ID: <20170809102521.pizo5vlqhb5unrin@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170609 (1.8.3) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "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 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);