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 <l...@intel.com>

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-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to