CC: [email protected]
TO: Otavio Salvador <[email protected]>

tree:   https://github.com/Freescale/linux-fslc 5.10-2.1.x-imx
head:   c0604ebbd45934a2c42df8382b674244d1963fa2
commit: 8b42bbc1841708fb512b5696fa2624a187c08185 [13135/15840] rpmsg: Move the 
rpmsg control device from rpmsg_char to rpmsg_ctrl
:::::: branch date: 5 days ago
:::::: commit date: 4 months ago
config: mips-randconfig-c004-20211203 
(https://download.01.org/0day-ci/archive/20211207/[email protected]/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
5f1d1854eb1450d352663ee732235893c5782237)
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://github.com/Freescale/linux-fslc/commit/8b42bbc1841708fb512b5696fa2624a187c08185
        git remote add freescale-fslc https://github.com/Freescale/linux-fslc
        git fetch --no-tags freescale-fslc 5.10-2.1.x-imx
        git checkout 8b42bbc1841708fb512b5696fa2624a187c08185
        # save the config file 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 >>)
   fs/utimes.c:207:1: note: Calling '__do_sys_utimes'
   SYSCALL_DEFINE2(utimes, char __user *, filename,
   ^
   include/linux/syscalls.h:214:36: note: expanded from macro 'SYSCALL_DEFINE2'
   #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:224:2: note: expanded from macro 'SYSCALL_DEFINEx'
           __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:245:14: note: expanded from macro 
'__SYSCALL_DEFINEx'
                   long ret = __do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__));\
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   fs/utimes.c:210:9: note: Calling 'do_futimesat'
           return do_futimesat(AT_FDCWD, filename, utimes);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/utimes.c:178:6: note: Assuming 'utimes' is non-null
           if (utimes) {
               ^~~~~~
   fs/utimes.c:178:2: note: Taking true branch
           if (utimes) {
           ^
   fs/utimes.c:179:7: note: Calling 'copy_from_user'
                   if (copy_from_user(&times, utimes, sizeof(times)))
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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:33: note: Assuming the condition is false
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
                                          ^
   include/linux/compiler.h:45:22: note: expanded from macro 'likely'
   #  define likely(x)     (__branch_check__(x, 1, __builtin_constant_p(x)))
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:33:32: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                       ^~~~
   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:616:2: note: Taking false branch
           if (eva_kernel_access())
           ^
   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:48:24: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:33:32: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                       ^~~~
   include/linux/uaccess.h:161:2: note: Taking false branch
           if (unlikely(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 zero (loaded from 'n'), which 
participates in a condition later
           return n;
           ^~~~~~~~
   fs/utimes.c:179:7: note: Returning from 'copy_from_user'
                   if (copy_from_user(&times, utimes, sizeof(times)))
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/utimes.c:179:3: note: Taking false branch
                   if (copy_from_user(&times, utimes, sizeof(times)))
                   ^
   fs/utimes.c:187:24: note: The left operand of '>=' is a garbage value
                   if (times[0].tv_usec >= 1000000 || times[0].tv_usec < 0 ||
                       ~~~~~~~~~~~~~~~~ ^
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   5 warnings generated.
>> drivers/rpmsg/rpmsg_ctrl.c:82:13: warning: Assigned value is garbage or 
>> undefined [clang-analyzer-core.uninitialized.Assign]
           chinfo.src = eptinfo.src;
                      ^ ~~~~~~~~~~~
   drivers/rpmsg/rpmsg_ctrl.c:74:13: note: Left side of '&&' is true
           if (cmd != RPMSG_CREATE_EPT_IOCTL)
                      ^
   include/uapi/linux/rpmsg.h:29:32: note: expanded from macro 
'RPMSG_CREATE_EPT_IOCTL'
   #define RPMSG_CREATE_EPT_IOCTL  _IOW(0xb5, 0x1, struct rpmsg_endpoint_info)
                                   ^
   include/uapi/asm-generic/ioctl.h:87:57: note: expanded from macro '_IOW'
   #define _IOW(type,nr,size)      
_IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
                                                                ^
   include/asm-generic/ioctl.h:13:4: note: expanded from macro '_IOC_TYPECHECK'
           ((sizeof(t) == sizeof(t[1]) && \
             ^
   drivers/rpmsg/rpmsg_ctrl.c:74:13: note: '?' condition is true
           if (cmd != RPMSG_CREATE_EPT_IOCTL)
                      ^
   include/uapi/linux/rpmsg.h:29:32: note: expanded from macro 
'RPMSG_CREATE_EPT_IOCTL'
   #define RPMSG_CREATE_EPT_IOCTL  _IOW(0xb5, 0x1, struct rpmsg_endpoint_info)
                                   ^
   include/uapi/asm-generic/ioctl.h:87:57: note: expanded from macro '_IOW'
   #define _IOW(type,nr,size)      
_IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
                                                                ^
   include/asm-generic/ioctl.h:13:3: note: expanded from macro '_IOC_TYPECHECK'
           ((sizeof(t) == sizeof(t[1]) && \
            ^
   drivers/rpmsg/rpmsg_ctrl.c:74:6: note: Assuming the condition is false
           if (cmd != RPMSG_CREATE_EPT_IOCTL)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/rpmsg/rpmsg_ctrl.c:74:2: note: Taking false branch
           if (cmd != RPMSG_CREATE_EPT_IOCTL)
           ^
   drivers/rpmsg/rpmsg_ctrl.c:77:6: note: Calling 'copy_from_user'
           if (copy_from_user(&eptinfo, argp, sizeof(eptinfo)))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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:33: note: Assuming the condition is false
           if (!should_fail_usercopy() && likely(access_ok(from, n))) {
                                          ^
   include/linux/compiler.h:45:22: note: expanded from macro 'likely'
   #  define likely(x)     (__branch_check__(x, 1, __builtin_constant_p(x)))
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:33:32: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                       ^~~~
   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:616:2: note: Taking false branch
           if (eva_kernel_access())
           ^
   arch/mips/include/asm/uaccess.h:619:3: note: Returning without writing to 
'to->src'
                   return __invoke_copy_from_user(to, from, n);
                   ^
   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:48:24: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:33:32: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                       ^~~~
   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'
           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'
           return n;

vim +82 drivers/rpmsg/rpmsg_ctrl.c

8b42bbc1841708 Arnaud Pouliquen 2021-05-17  65  
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  66  static long 
rpmsg_ctrldev_ioctl(struct file *fp, unsigned int cmd,
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  67                                  
unsigned long arg)
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  68  {
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  69          struct rpmsg_ctrldev 
*ctrldev = fp->private_data;
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  70          void __user *argp = 
(void __user *)arg;
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  71          struct 
rpmsg_endpoint_info eptinfo;
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  72          struct 
rpmsg_channel_info chinfo;
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  73  
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  74          if (cmd != 
RPMSG_CREATE_EPT_IOCTL)
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  75                  return -EINVAL;
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  76  
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  77          if 
(copy_from_user(&eptinfo, argp, sizeof(eptinfo)))
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  78                  return -EFAULT;
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  79  
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  80          memcpy(chinfo.name, 
eptinfo.name, RPMSG_NAME_SIZE);
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  81          
chinfo.name[RPMSG_NAME_SIZE - 1] = '\0';
8b42bbc1841708 Arnaud Pouliquen 2021-05-17 @82          chinfo.src = 
eptinfo.src;
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  83          chinfo.dst = 
eptinfo.dst;
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  84  
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  85          return 
rpmsg_chrdev_eptdev_create(ctrldev->rpdev, &ctrldev->dev, chinfo);
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  86  };
8b42bbc1841708 Arnaud Pouliquen 2021-05-17  87  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to