public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Qinglang Miao
	<miaoqinglang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Li Zefan <lizf.kern-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: kbuild-all-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
	clang-built-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Qinglang Miao
	<miaoqinglang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH] cgroup: Fix memory leak when parsing multiple source parameters
Date: Wed, 9 Dec 2020 23:33:46 +0800	[thread overview]
Message-ID: <202012092338.LZNbiCpZ-lkp@intel.com> (raw)
In-Reply-To: <20201209121322.77665-1-miaoqinglang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 6275 bytes --]

Hi Qinglang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on cgroup/for-next]
[also build test WARNING on v5.10-rc7 next-20201209]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Qinglang-Miao/cgroup-Fix-memory-leak-when-parsing-multiple-source-parameters/20201209-201041
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-next
config: x86_64-randconfig-a004-20201209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1968804ac726e7674d5de22bc2204b45857da344)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/f80ce6cc8c1bde7ecab3fed9f9a514091cec6f56
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Qinglang-Miao/cgroup-Fix-memory-leak-when-parsing-multiple-source-parameters/20201209-201041
        git checkout f80ce6cc8c1bde7ecab3fed9f9a514091cec6f56
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

All warnings (new ones prefixed by >>):

>> kernel/cgroup/cgroup-v1.c:912:23: warning: missing terminating '"' character [-Winvalid-pp-token]
                                   return invalf(fc, "Multiple sources not
                                                     ^
   kernel/cgroup/cgroup-v1.c:913:18: warning: missing terminating '"' character [-Winvalid-pp-token]
                                                     supported");
                                                              ^
   kernel/cgroup/cgroup-v1.c:912:12: error: unterminated function-like macro invocation
                                   return invalf(fc, "Multiple sources not
                                          ^
   include/linux/fs_context.h:241:9: note: macro 'invalf' defined here
   #define invalf(fc, fmt, ...) (errorf(fc, fmt, ## __VA_ARGS__), -EINVAL)
           ^
   kernel/cgroup/cgroup-v1.c:1276:40: error: expected expression
   __setup("cgroup_no_v1=", cgroup_no_v1);
                                          ^
   kernel/cgroup/cgroup-v1.c:1276:40: error: expected '}'
   kernel/cgroup/cgroup-v1.c:910:42: note: to match this '{'
                   if (strcmp(param->key, "source") == 0) {
                                                          ^
   kernel/cgroup/cgroup-v1.c:1276:40: error: expected '}'
   __setup("cgroup_no_v1=", cgroup_no_v1);
                                          ^
   kernel/cgroup/cgroup-v1.c:909:24: note: to match this '{'
           if (opt == -ENOPARAM) {
                                 ^
   kernel/cgroup/cgroup-v1.c:1276:40: error: expected '}'
   __setup("cgroup_no_v1=", cgroup_no_v1);
                                          ^
   kernel/cgroup/cgroup-v1.c:902:1: note: to match this '{'
   {
   ^
   2 warnings and 5 errors generated.

vim +912 kernel/cgroup/cgroup-v1.c

   900	
   901	int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param)
   902	{
   903		struct cgroup_fs_context *ctx = cgroup_fc2context(fc);
   904		struct cgroup_subsys *ss;
   905		struct fs_parse_result result;
   906		int opt, i;
   907	
   908		opt = fs_parse(fc, cgroup1_fs_parameters, param, &result);
   909		if (opt == -ENOPARAM) {
   910			if (strcmp(param->key, "source") == 0) {
   911				if (fc->source)
 > 912					return invalf(fc, "Multiple sources not
   913							  supported");
   914				fc->source = param->string;
   915				param->string = NULL;
   916				return 0;
   917			}
   918			for_each_subsys(ss, i) {
   919				if (strcmp(param->key, ss->legacy_name))
   920					continue;
   921				ctx->subsys_mask |= (1 << i);
   922				return 0;
   923			}
   924			return invalfc(fc, "Unknown subsys name '%s'", param->key);
   925		}
   926		if (opt < 0)
   927			return opt;
   928	
   929		switch (opt) {
   930		case Opt_none:
   931			/* Explicitly have no subsystems */
   932			ctx->none = true;
   933			break;
   934		case Opt_all:
   935			ctx->all_ss = true;
   936			break;
   937		case Opt_noprefix:
   938			ctx->flags |= CGRP_ROOT_NOPREFIX;
   939			break;
   940		case Opt_clone_children:
   941			ctx->cpuset_clone_children = true;
   942			break;
   943		case Opt_cpuset_v2_mode:
   944			ctx->flags |= CGRP_ROOT_CPUSET_V2_MODE;
   945			break;
   946		case Opt_xattr:
   947			ctx->flags |= CGRP_ROOT_XATTR;
   948			break;
   949		case Opt_release_agent:
   950			/* Specifying two release agents is forbidden */
   951			if (ctx->release_agent)
   952				return invalfc(fc, "release_agent respecified");
   953			ctx->release_agent = param->string;
   954			param->string = NULL;
   955			break;
   956		case Opt_name:
   957			/* blocked by boot param? */
   958			if (cgroup_no_v1_named)
   959				return -ENOENT;
   960			/* Can't specify an empty name */
   961			if (!param->size)
   962				return invalfc(fc, "Empty name");
   963			if (param->size > MAX_CGROUP_ROOT_NAMELEN - 1)
   964				return invalfc(fc, "Name too long");
   965			/* Must match [\w.-]+ */
   966			for (i = 0; i < param->size; i++) {
   967				char c = param->string[i];
   968				if (isalnum(c))
   969					continue;
   970				if ((c == '.') || (c == '-') || (c == '_'))
   971					continue;
   972				return invalfc(fc, "Invalid name");
   973			}
   974			/* Specifying two names is forbidden */
   975			if (ctx->name)
   976				return invalfc(fc, "name respecified");
   977			ctx->name = param->string;
   978			param->string = NULL;
   979			break;
   980		}
   981		return 0;
   982	}
   983	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40544 bytes --]

  parent reply	other threads:[~2020-12-09 15:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 12:13 [PATCH] cgroup: Fix memory leak when parsing multiple source parameters Qinglang Miao
2020-12-09 13:59 ` kernel test robot
     [not found] ` <20201209121322.77665-1-miaoqinglang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-12-09 15:33   ` kernel test robot [this message]
2020-12-10  1:29 ` [PATCH v2] " Qinglang Miao
     [not found]   ` <20201210012943.92845-1-miaoqinglang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-12-15  8:50     ` Zefan Li
2020-12-16 15:11   ` Tejun Heo
2020-12-15  8:39 ` [PATCH] " Zefan Li

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=202012092338.LZNbiCpZ-lkp@intel.com \
    --to=lkp-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=clang-built-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=kbuild-all-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizf.kern-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=miaoqinglang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /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