use cgrp == cgrp->top_cgroup instead of cgrp == NULL Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx> --- kernel/cgroup.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c index b0caa1d..c111cf9 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -1976,12 +1976,14 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) if ((start -= len) < buf) return -ENAMETOOLONG; memcpy(start, dentry->d_name.name, len); - cgrp = cgrp->parent; - if (!cgrp) + + if (cgrp == cgrp->top_cgroup) break; + cgrp = cgrp->parent; dentry = cgrp->dentry; - if (!cgrp->parent) + + if (cgrp == cgrp->top_cgroup) continue; if (--start < buf) return -ENAMETOOLONG; -- 1.7.7.6 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/containers