CC: [email protected]
CC: [email protected]
CC: "Darrick J. Wong" <[email protected]>
CC: [email protected]
TO: "Darrick J. Wong" <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git 
vectorized-scrub
head:   142ad7efefdd71fa40628c868530a9357c18ba27
commit: ce0efd9a8d8bc41ec45652362b722473ef20947f [104/303] vfs: introduce new 
file range exchange ioctl
:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago
config: mips-randconfig-c004-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=ce0efd9a8d8bc41ec45652362b722473ef20947f
        git remote add djwong-xfs 
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
        git fetch --no-tags djwong-xfs vectorized-scrub
        git checkout ce0efd9a8d8bc41ec45652362b722473ef20947f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
   note: expanded from here
   fs/ioctl.c:1095:6: note: Assuming field 'file' is non-null
           if (!f.file)
               ^~~~~~~
   fs/ioctl.c:1095:2: note: Taking false branch
           if (!f.file)
           ^
   fs/ioctl.c:1099:6: note: 'error' is 0
           if (error)
               ^~~~~
   fs/ioctl.c:1099:2: note: Taking false branch
           if (error)
           ^
   fs/ioctl.c:1102:10: note: Calling 'do_vfs_ioctl'
           error = do_vfs_ioctl(f.file, fd, cmd, arg);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ioctl.c:1009:2: note: Control jumps to 'case 2149618701:'  at line 1053
           switch (cmd) {
           ^
   fs/ioctl.c:1054:10: note: Calling 'ioctl_file_clone_range'
                   return ioctl_file_clone_range(filp, argp);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ioctl.c:260:6: note: Calling 'copy_from_user'
           if (copy_from_user(&args, argp, sizeof(args)))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:191:2: note: Taking true branch
           if (likely(check_copy_size(to, n, false)))
           ^
   include/linux/uaccess.h:192:7: note: Calling '_copy_from_user'
                   n = _copy_from_user(to, from, n);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:157:7: note: Calling 'should_fail_usercopy'
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
                ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/fault-inject-usercopy.h:18:49: note: Returning zero, which 
participates in a condition later
   static inline bool should_fail_usercopy(void) { return false; }
                                                   ^~~~~~~~~~~~
   include/linux/uaccess.h:157:7: note: Returning from 'should_fail_usercopy'
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
                ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:157:6: note: Left side of '&&' is true
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
               ^
   include/linux/uaccess.h:157:40: note: Assuming the condition is false
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
                                                 ^
   arch/mips/include/asm/uaccess.h:88:2: note: expanded from macro 'access_ok'
           likely(__access_ok((addr), (size)))
           ^
   include/linux/compiler.h:77:38: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                                             ^
   include/linux/compiler.h:77:40: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                                               ^
   include/linux/uaccess.h:157:2: note: Taking true branch
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
           ^
   include/linux/uaccess.h:159:9: note: Calling 'raw_copy_from_user'
                   res = raw_copy_from_user(to, from, n);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:456:2: note: Returning without writing to 
'to->src_fd'
           return __cu_len_r;
           ^
   include/linux/uaccess.h:159:9: note: Returning from 'raw_copy_from_user'
                   res = raw_copy_from_user(to, from, n);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:161:6: note: Assuming 'res' is 0, which participates 
in a condition later
           if (unlikely(res))
               ^
   include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                             ^~~~
   include/linux/uaccess.h:161:2: note: Taking false branch
           if (unlikely(res))
           ^
   include/linux/uaccess.h:163:2: note: Returning without writing to 
'to->src_fd'
           return res;
           ^
   include/linux/uaccess.h:163:2: note: Returning zero (loaded from 'res'), 
which participates in a condition later
           return res;
           ^~~~~~~~~~
   include/linux/uaccess.h:192:7: note: Returning from '_copy_from_user'
                   n = _copy_from_user(to, from, n);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:193:2: note: Returning without writing to 
'to->src_fd'
           return n;
           ^
   include/linux/uaccess.h:193:2: note: Returning zero (loaded from 'n'), which 
participates in a condition later
           return n;
           ^~~~~~~~
   fs/ioctl.c:260:6: note: Returning from 'copy_from_user'
           if (copy_from_user(&args, argp, sizeof(args)))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ioctl.c:260:2: note: Taking false branch
           if (copy_from_user(&args, argp, sizeof(args)))
           ^
   fs/ioctl.c:262:9: note: 2nd function call argument is an uninitialized value
           return ioctl_file_clone(file, args.src_fd, args.src_offset,
                  ^                      ~~~~~~~~~~~
>> fs/ioctl.c:276:10: warning: 1st function call argument is an uninitialized 
>> value [clang-analyzer-core.CallAndMessage]
           file1 = fdget(args.file1_fd);
                   ^
   fs/ioctl.c:1090:1: note: Calling '__do_sys_ioctl'
   SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, 
arg)
   ^
   include/linux/syscalls.h:218:36: note: expanded from macro 'SYSCALL_DEFINE3'
   #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:227:2: note: expanded from macro 'SYSCALL_DEFINEx'
           __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:248:14: note: expanded from macro 
'__SYSCALL_DEFINEx'
                   long ret = __do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__));\
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   fs/ioctl.c:1095:6: note: Assuming field 'file' is non-null
           if (!f.file)
               ^~~~~~~
   fs/ioctl.c:1095:2: note: Taking false branch
           if (!f.file)
           ^
   fs/ioctl.c:1099:6: note: 'error' is 0
           if (error)
               ^~~~~
   fs/ioctl.c:1099:2: note: Taking false branch
           if (error)
           ^
   fs/ioctl.c:1102:10: note: Calling 'do_vfs_ioctl'
           error = do_vfs_ioctl(f.file, fd, cmd, arg);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ioctl.c:1009:2: note: Control jumps to 'case 3229112449:'  at line 1059
           switch (cmd) {
           ^
   fs/ioctl.c:1060:10: note: Calling 'ioctl_file_xchg_range'
                   return ioctl_file_xchg_range(filp, argp);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ioctl.c:273:6: note: Calling 'copy_from_user'
           if (copy_from_user(&args, argp, sizeof(args)))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:191:2: note: Taking true branch
           if (likely(check_copy_size(to, n, false)))
           ^
   include/linux/uaccess.h:192:7: note: Calling '_copy_from_user'
                   n = _copy_from_user(to, from, n);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:157:7: note: Calling 'should_fail_usercopy'
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
                ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/fault-inject-usercopy.h:18:49: note: Returning zero, which 
participates in a condition later
   static inline bool should_fail_usercopy(void) { return false; }
                                                   ^~~~~~~~~~~~
   include/linux/uaccess.h:157:7: note: Returning from 'should_fail_usercopy'
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
                ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:157:6: note: Left side of '&&' is true
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
               ^
   include/linux/uaccess.h:157:40: note: Assuming the condition is false
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
                                                 ^
   arch/mips/include/asm/uaccess.h:88:2: note: expanded from macro 'access_ok'
           likely(__access_ok((addr), (size)))
           ^
   include/linux/compiler.h:77:38: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                                             ^
   include/linux/compiler.h:77:40: note: expanded from macro 'likely'
   # define likely(x)      __builtin_expect(!!(x), 1)
                                               ^
   include/linux/uaccess.h:157:2: note: Taking true branch
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
           ^
   include/linux/uaccess.h:159:9: note: Calling 'raw_copy_from_user'
                   res = raw_copy_from_user(to, from, n);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/mips/include/asm/uaccess.h:456:2: note: Returning without writing to 
'to->file1_fd'
           return __cu_len_r;
           ^
   include/linux/uaccess.h:159:9: note: Returning from 'raw_copy_from_user'
                   res = raw_copy_from_user(to, from, n);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:161:6: note: Assuming 'res' is 0, which participates 
in a condition later
           if (unlikely(res))
               ^
   include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                             ^~~~
   include/linux/uaccess.h:161:2: note: Taking false branch
           if (unlikely(res))
           ^
   include/linux/uaccess.h:163:2: note: Returning without writing to 
'to->file1_fd'
           return res;
           ^
   include/linux/uaccess.h:163:2: note: Returning zero (loaded from 'res'), 
which participates in a condition later
           return res;
           ^~~~~~~~~~
   include/linux/uaccess.h:192:7: note: Returning from '_copy_from_user'
                   n = _copy_from_user(to, from, n);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:193:2: note: Returning without writing to 
'to->file1_fd'

vim +276 fs/ioctl.c

04b38d601239b4 Christoph Hellwig 2015-12-03  265  
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  266  static long 
ioctl_file_xchg_range(struct file *file2,
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  267                                
  struct file_xchg_range __user *argp)
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  268  {
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  269        struct file_xchg_range 
args;
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  270        struct fd file1;
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  271        int ret;
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  272  
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  273        if 
(copy_from_user(&args, argp, sizeof(args)))
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  274                return -EFAULT;
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  275  
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09 @276        file1 = 
fdget(args.file1_fd);
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  277        if (!file1.file)
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  278                return -EBADF;
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  279  
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  280        ret = -EXDEV;
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  281        if 
(file1.file->f_path.mnt != file2->f_path.mnt)
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  282                goto fdput;
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  283  
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  284        ret = 
vfs_xchg_file_range(file1.file, file2, &args);
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  285  fdput:
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  286        fdput(file1);
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  287        return ret;
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  288  }
ce0efd9a8d8bc4 Darrick J. Wong   2021-07-09  289  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to