Commit 1e0e8370 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

cgroup: fix dereference before null check

Coverity: 1230177 Dereference before null check

There may be a null pointer dereference, or else the comparison against
null is unnecessary.  In parse_task_cgroup: All paths that lead to this
null pointer comparison already dereference the pointer earlier
(CWE-476)
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ca94dc9b
......@@ -1598,6 +1598,7 @@ int parse_task_cgroup(int pid, struct list_head *retl, unsigned int *n)
* 2:name=systemd:/user.slice/user-1000.slice/session-1.scope
*/
name = strchr(buf, ':') + 1;
if (name)
path = strchr(name, ':');
if (!name || !path) {
pr_err("Failed parsing cgroup %s\n", buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment