Skip to content

Commit 8619e94

Browse files
ye xingchenhtejun
authored andcommitted
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>
1 parent b74440d commit 8619e94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/cgroup/cgroup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2374,7 +2374,7 @@ int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen)
23742374
ret = cgroup_path_ns_locked(cgrp, buf, buflen, &init_cgroup_ns);
23752375
} else {
23762376
/* if no hierarchy exists, everyone is in "/" */
2377-
ret = strlcpy(buf, "/", buflen);
2377+
ret = strscpy(buf, "/", buflen);
23782378
}
23792379

23802380
spin_unlock_irq(&css_set_lock);

0 commit comments

Comments
 (0)