lkml.org 
[lkml]   [2017]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] cgroup: avoid cgroup root name longer than max
Date
cgroup root name has max length limit, we should avoid copying
longer name than that to the name.

Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
---
kernel/cgroup/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 0b1ffe147f24..3614a21ad6b8 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1866,7 +1866,7 @@ void init_cgroup_root(struct cgroup_root *root, struct cgroup_sb_opts *opts)
if (opts->release_agent)
strcpy(root->release_agent_path, opts->release_agent);
if (opts->name)
- strcpy(root->name, opts->name);
+ strncpy(root->name, opts->name, MAX_CGROUP_ROOT_NAMELEN);
if (opts->cpuset_clone_children)
set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags);
}
--
2.13.6


\
 
 \ /
  Last update: 2017-12-08 09:47    [W:0.024 / U:1.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site