Re: [PATCH] zonefs: add uid,gid,perm mount option

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

 



Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 1e28eed17697bcf343c6743f0028cc3b5dd88bf0]

url:    https://github.com/0day-ci/linux/commits/tomwei7g-gmail-com/zonefs-add-uid-gid-perm-mount-option/20210424-221530
base:   1e28eed17697bcf343c6743f0028cc3b5dd88bf0
config: x86_64-randconfig-a004-20210424 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8e9d17fd4243faa954ae35a4da94e5e922e458e5)
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/219d3c453ff7baa144c61b429f1df96b0d2617a3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review tomwei7g-gmail-com/zonefs-add-uid-gid-perm-mount-option/20210424-221530
        git checkout 219d3c453ff7baa144c61b429f1df96b0d2617a3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> fs/zonefs/super.c:1195:7: warning: variable 'arg' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
                           if(args->from && match_int(args, &arg))
                              ^~~~~~~~~~
   fs/zonefs/super.c:1197:46: note: uninitialized use occurs here
                           sbi->s_uid = make_kuid(current_user_ns(), arg);
                                                                     ^~~
   fs/zonefs/super.c:1195:7: note: remove the '&&' if its condition is always true
                           if(args->from && match_int(args, &arg))
                              ^~~~~~~~~~~~~
   fs/zonefs/super.c:1165:10: note: initialize the variable 'arg' to silence this warning
                   int arg;
                          ^
                           = 0
   1 warning generated.


vim +1195 fs/zonefs/super.c

  1153	
  1154	static int zonefs_parse_options(struct super_block *sb, char *options)
  1155	{
  1156		struct zonefs_sb_info *sbi = ZONEFS_SB(sb);
  1157		substring_t args[MAX_OPT_ARGS];
  1158		char *p;
  1159	
  1160		if (!options)
  1161			return 0;
  1162	
  1163		while ((p = strsep(&options, ",")) != NULL) {
  1164			int token;
  1165			int arg;
  1166	
  1167			if (!*p)
  1168				continue;
  1169	
  1170			args[0].to = args[0].from = NULL;
  1171	
  1172			token = match_token(p, tokens, args);
  1173			switch (token) {
  1174			case Opt_errors_ro:
  1175				sbi->s_mount_opts &= ~ZONEFS_MNTOPT_ERRORS_MASK;
  1176				sbi->s_mount_opts |= ZONEFS_MNTOPT_ERRORS_RO;
  1177				break;
  1178			case Opt_errors_zro:
  1179				sbi->s_mount_opts &= ~ZONEFS_MNTOPT_ERRORS_MASK;
  1180				sbi->s_mount_opts |= ZONEFS_MNTOPT_ERRORS_ZRO;
  1181				break;
  1182			case Opt_errors_zol:
  1183				sbi->s_mount_opts &= ~ZONEFS_MNTOPT_ERRORS_MASK;
  1184				sbi->s_mount_opts |= ZONEFS_MNTOPT_ERRORS_ZOL;
  1185				break;
  1186			case Opt_errors_repair:
  1187				sbi->s_mount_opts &= ~ZONEFS_MNTOPT_ERRORS_MASK;
  1188				sbi->s_mount_opts |= ZONEFS_MNTOPT_ERRORS_REPAIR;
  1189				break;
  1190			case Opt_explicit_open:
  1191				sbi->s_mount_opts |= ZONEFS_MNTOPT_EXPLICIT_OPEN;
  1192				break;
  1193			case Opt_uid:
  1194				sbi->s_mount_opts |= ZONEFS_MNTOPT_UID;
> 1195				if(args->from && match_int(args, &arg))
  1196					return -EINVAL;
  1197				sbi->s_uid = make_kuid(current_user_ns(), arg);
  1198				if (!uid_valid(sbi->s_uid)) {
  1199					zonefs_err(sb, "Invalid uid value %d\n", arg);
  1200					return -EINVAL;
  1201				}
  1202				break;
  1203			case Opt_gid:
  1204				sbi->s_mount_opts |= ZONEFS_MNTOPT_GID;
  1205				if(args->from && match_int(args, &arg))
  1206					return -EINVAL;
  1207				sbi->s_gid = make_kgid(current_user_ns(), arg);
  1208				if (!gid_valid(sbi->s_gid)) {
  1209					zonefs_err(sb, "Invalid gid value %d\n", arg);
  1210					return -EINVAL;
  1211				}
  1212				break;
  1213			case Opt_perm:
  1214				sbi->s_mount_opts |= ZONEFS_MNTOPT_PERM;
  1215				if(args->from && match_int(args, &arg))
  1216					return -EINVAL;
  1217				sbi->s_perm = arg;
  1218				break;
  1219			default:
  1220				return -EINVAL;
  1221			}
  1222		}
  1223	
  1224		return 0;
  1225	}
  1226	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux