Re: [PATCH] cgroup: avoid cgroup root name longer than max

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 08, 2017 at 04:47:46PM +0800, Ma Shimiao wrote:
> 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@xxxxxxxxxxxxxx>
> ---
>  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);

Ditto here, let's use strscpy().

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux