Re: [PATCH] xattr: switch to vmemdup_user()

From: kernel test robot
Date: Wed Sep 29 2021 - 17:21:38 EST


Hi Yang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.15-rc3 next-20210922]
[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/Yang-Li/xattr-switch-to-vmemdup_user/20210929-221309
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a4e6f95a891ac08bd09d62e3e6dae239b150f4c1
config: hexagon-randconfig-r045-20210929 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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
# https://github.com/0day-ci/linux/commit/c26396dd8ad04ac32a6dee98d97706c53432ee2f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yang-Li/xattr-switch-to-vmemdup_user/20210929-221309
git checkout c26396dd8ad04ac32a6dee98d97706c53432ee2f
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

>> fs/xattr.c:566:4: error: use of undeclared identifier 'r'
r = PTR_ERR(kvalue);
^
1 error generated.


vim +/r +566 fs/xattr.c

538
539 /*
540 * Extended attribute SET operations
541 */
542 static long
543 setxattr(struct user_namespace *mnt_userns, struct dentry *d,
544 const char __user *name, const void __user *value, size_t size,
545 int flags)
546 {
547 int error;
548 void *kvalue = NULL;
549 char kname[XATTR_NAME_MAX + 1];
550
551 if (flags & ~(XATTR_CREATE|XATTR_REPLACE))
552 return -EINVAL;
553
554 error = strncpy_from_user(kname, name, sizeof(kname));
555 if (error == 0 || error == sizeof(kname))
556 error = -ERANGE;
557 if (error < 0)
558 return error;
559
560 if (size) {
561 if (size > XATTR_SIZE_MAX)
562 return -E2BIG;
563 kvalue = vmemdup_user(value, size);
564
565 if (IS_ERR(kvalue)) {
> 566 r = PTR_ERR(kvalue);
567 goto out;
568 }
569 if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
570 (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
571 posix_acl_fix_xattr_from_user(mnt_userns, kvalue, size);
572 }
573
574 error = vfs_setxattr(mnt_userns, d, kname, kvalue, size, flags);
575 out:
576 kvfree(kvalue);
577
578 return error;
579 }
580

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

Attachment: .config.gz
Description: application/gzip