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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <20180122133851.19772-1-sxwjean@me.com>
Date:   Mon, 22 Jan 2018 21:38:51 +0800
From:   Xiongwei Song <sxwjean@...com>
To:     tj@...nel.org, guro@...com, longman@...hat.com,
        davem@...emloft.net, akpm@...ux-foundation.org
Cc:     linux-kernel@...r.kernel.org, sxwjean@...il.com
Subject: [PATCH] cgroup: remove incorrect check on the return value of css_alloc

The function css_alloc never return NULL, it may return normal pointer or
error codes that made by ERR_PTR, so !css is always false, we need use
IS_ERR to check it, and if this is true, we should use ERR_CAST handle it.

Signed-off-by: Xiongwei Song <sxwjean@...com>
---
 kernel/cgroup/cgroup.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index adac5b91d2b8..a442fd9ad744 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4728,10 +4728,8 @@ static struct cgroup_subsys_state *css_create(struct cgroup *cgrp,
 	lockdep_assert_held(&cgroup_mutex);
 
 	css = ss->css_alloc(parent_css);
-	if (!css)
-		css = ERR_PTR(-ENOMEM);
 	if (IS_ERR(css))
-		return css;
+		return ERR_CAST(css);
 
 	init_and_link_css(css, ss, cgrp);
 
-- 
2.15.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ