mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Cc: lizefan@huawei.com, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cgroup: avoid cgroup root name longer than max
Date: Mon, 11 Dec 2017 07:12:34 -0800	[thread overview]
Message-ID: <20171211151234.GE2421075@devbig577.frc2.facebook.com> (raw)
In-Reply-To: <20171208084746.5793-1-mashimiao.fnst@cn.fujitsu.com>

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@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);

Ditto here, let's use strscpy().

Thanks.

-- 
tejun

      reply	other threads:[~2017-12-11 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08  8:47 Ma Shimiao
2017-12-11 15:12 ` Tejun Heo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171211151234.GE2421075@devbig577.frc2.facebook.com \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mashimiao.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®