lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200829100202.GA855@haolee.github.io>
Date:   Sat, 29 Aug 2020 10:03:16 +0000
From:   Hao Lee <haolee.swjtu@...il.com>
To:     tj@...nel.org
Cc:     lizefan@...wei.com, hannes@...xchg.org, cgroups@...r.kernel.org,
        linux-kernel@...r.kernel.org, haolee.swjtu@...il.com
Subject: [PATCH] cgroup: Delete unnecessary if statement in css_visible()

css_visible() is called in either cgroup_apply_control_enable()
or cgroup_apply_control_disable().
In cgroup_apply_control_enable(), we have checked ss_mask before calling
css_visible(), so there is no need to do the same thing again.
In cgroup_apply_control_disable():
 - If css->parent is not NULL, we have checked ss_mask in the
   second condition, so there is no need to do the same thing again.
 - If css->parent is NULL, dsct is root cgroup so the deleted if
   statement is always false and there is no need to keep it.

Signed-off-by: Hao Lee <haolee.swjtu@...il.com>
---
 kernel/cgroup/cgroup.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index dd247747ec14..b6714166106d 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -3023,8 +3023,6 @@ static bool css_visible(struct cgroup_subsys_state *css)
 
 	if (cgroup_control(cgrp) & (1 << ss->id))
 		return true;
-	if (!(cgroup_ss_mask(cgrp) & (1 << ss->id)))
-		return false;
 	return cgroup_on_dfl(cgrp) && ss->implicit_on_dfl;
 }
 
-- 
2.24.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ