Re: [PATCH] f2fs: add f2fs_ioc_[get|set]_extra_attr

From: kernel test robot
Date: Mon May 29 2023 - 02:20:46 EST


Hi Sheng,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jaegeuk-f2fs/dev-test]
[also build test WARNING on jaegeuk-f2fs/dev next-20230525]
[cannot apply to linus/master v6.4-rc4]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Sheng-Yong/f2fs-add-f2fs_ioc_-get-set-_extra_attr/20230529-093611
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link: https://lore.kernel.org/r/20230529013502.2230810-1-shengyong%40oppo.com
patch subject: [PATCH] f2fs: add f2fs_ioc_[get|set]_extra_attr
config: arc-buildonly-randconfig-r004-20230529 (https://download.01.org/0day-ci/archive/20230529/202305291408.kdy2Itan-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/519a8b3bbd4d743ae67c32dfef61e8bfa0951cc5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sheng-Yong/f2fs-add-f2fs_ioc_-get-set-_extra_attr/20230529-093611
git checkout 519a8b3bbd4d743ae67c32dfef61e8bfa0951cc5
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 ~/bin/make.cross W=1 O=build_dir ARCH=arc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 ~/bin/make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash fs/f2fs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305291408.kdy2Itan-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

fs/f2fs/file.c: In function 'f2fs_ioc_get_extra_attr':
>> fs/f2fs/file.c:4312:44: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
4312 | (void __user *)attr.attr))
| ^
fs/f2fs/file.c:4316:48: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
4316 | (void __user *)attr.attr))
| ^


vim +4312 fs/f2fs/file.c

4262
4263 static int f2fs_ioc_get_extra_attr(struct file *filp, unsigned long arg)
4264 {
4265 struct inode *inode = file_inode(filp);
4266 struct f2fs_inode_info *fi = F2FS_I(inode);
4267 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
4268 struct f2fs_extra_attr attr;
4269 u32 chksum;
4270 int ret = 0;
4271
4272 if (!f2fs_has_extra_attr(inode))
4273 return -EOPNOTSUPP;
4274
4275 if (copy_from_user(&attr, (void __user *)arg, sizeof(attr)))
4276 return -EFAULT;
4277
4278 if (attr.field >= F2FS_EXTRA_ATTR_MAX)
4279 return -EINVAL;
4280
4281 if (!extra_attr_fits_in_inode(inode, attr.field))
4282 return -EOPNOTSUPP;
4283
4284 switch (attr.field) {
4285 case F2FS_EXTRA_ATTR_TOTAL_SIZE:
4286 attr.attr = F2FS_TOTAL_EXTRA_ATTR_SIZE;
4287 break;
4288 case F2FS_EXTRA_ATTR_ISIZE:
4289 attr.attr = fi->i_extra_isize;
4290 break;
4291 case F2FS_EXTRA_ATTR_INLINE_XATTR_SIZE:
4292 if (!f2fs_has_inline_xattr(inode))
4293 return -EOPNOTSUPP;
4294 attr.attr = get_inline_xattr_addrs(inode);
4295 break;
4296 case F2FS_EXTRA_ATTR_PROJID:
4297 if (!f2fs_sb_has_project_quota(F2FS_I_SB(inode)))
4298 return -EOPNOTSUPP;
4299 attr.attr = from_kprojid(&init_user_ns, fi->i_projid);
4300 break;
4301 case F2FS_EXTRA_ATTR_INODE_CHKSUM:
4302 ret = f2fs_inode_chksum_get(sbi, inode, &chksum);
4303 if (ret)
4304 return ret;
4305 attr.attr = chksum;
4306 break;
4307 case F2FS_EXTRA_ATTR_CRTIME:
4308 if (!f2fs_sb_has_inode_crtime(sbi))
4309 return -EOPNOTSUPP;
4310 if (attr.attr_size == sizeof(struct timespec64)) {
4311 if (put_timespec64(&fi->i_crtime,
> 4312 (void __user *)attr.attr))
4313 return -EFAULT;
4314 } else if (attr.attr_size == sizeof(struct old_timespec32)) {
4315 if (put_old_timespec32(&fi->i_crtime,
4316 (void __user *)attr.attr))
4317 return -EFAULT;
4318 } else {
4319 return -EINVAL;
4320 }
4321 break;
4322 case F2FS_EXTRA_ATTR_COMPR_BLOCKS:
4323 ret = f2fs_get_compress_blocks(filp, attr.attr_size);
4324 attr.attr = ret;
4325 break;
4326 case F2FS_EXTRA_ATTR_COMPR_OPTION:
4327 ret = f2fs_get_compress_option_v2(filp, attr.attr,
4328 &attr.attr_size);
4329 break;
4330 default:
4331 return -EINVAL;
4332 }
4333
4334 if (ret < 0)
4335 return ret;
4336
4337 if (copy_to_user((void __user *)arg, &attr, sizeof(attr)))
4338 return -EFAULT;
4339
4340 return 0;
4341 }
4342

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki