Re: [PATCH] xattr: switch to vmemdup_user()
From: kernel test robot
Date: Wed Sep 29 2021 - 18:39:08 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: x86_64-randconfig-c001-20210929 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# 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
make W=1 O=build_dir ARCH=x86_64 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: In function 'setxattr':
>> fs/xattr.c:566:4: error: 'r' undeclared (first use in this function)
566 | r = PTR_ERR(kvalue);
| ^
fs/xattr.c:566:4: note: each undeclared identifier is reported only once for each function it appears in
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