summaryrefslogtreecommitdiffstats
path: root/kernel/cgroup
diff options
context:
space:
mode:
authorye xingchen <ye.xingchen@zte.com.cn>2022-09-21 09:35:17 +0000
committerTejun Heo <tj@kernel.org>2022-09-23 17:27:02 -1000
commit8619e94d3be376bb5e8f20988c0e6e3309d2b09a (patch)
treeb969cd1ce57e3b2c6730d2c3e2a7071fa11bbd56 /kernel/cgroup
parentb74440d89895816660236be4433f0891e37d44eb (diff)
downloadlinux-stable-8619e94d3be376bb5e8f20988c0e6e3309d2b09a.tar.gz
linux-stable-8619e94d3be376bb5e8f20988c0e6e3309d2b09a.tar.bz2
linux-stable-8619e94d3be376bb5e8f20988c0e6e3309d2b09a.zip
cgroup: use strscpy() is more robust and safer
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL terminated strings. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cgroup')
-rw-r--r--kernel/cgroup/cgroup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index c37b8265c0a3..151c55d2e016 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2374,7 +2374,7 @@ int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen)
ret = cgroup_path_ns_locked(cgrp, buf, buflen, &init_cgroup_ns);
} else {
/* if no hierarchy exists, everyone is in "/" */
- ret = strlcpy(buf, "/", buflen);
+ ret = strscpy(buf, "/", buflen);
}
spin_unlock_irq(&css_set_lock);