Browse Source

cgroup: set 'start' with the right value in cgroup_path.

'start' is set to buf + buflen and do the '--' immediately.
Just set it to 'buf + buflen - 1' directly.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Tao Ma 12 years ago
parent
commit
316eb661f1
1 changed files with 2 additions and 2 deletions
  1. 2 2
      kernel/cgroup.c

+ 2 - 2
kernel/cgroup.c

@@ -1770,9 +1770,9 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
 		return 0;
 	}
 
-	start = buf + buflen;
+	start = buf + buflen - 1;
 
-	*--start = '\0';
+	*start = '\0';
 	for (;;) {
 		int len = dentry->d_name.len;