[PATCH 3/4] riscv: uaccess: use 'asm goto' for put_user()

kernel test robot lkp at intel.com
Fri Jul 5 17:02:40 PDT 2024


Hi Jisheng,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.10-rc6 next-20240703]
[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/Jisheng-Zhang/riscv-implement-user_access_begin-and-families/20240626-005352
base:   linus/master
patch link:    https://lore.kernel.org/r/20240625040500.1788-4-jszhang%40kernel.org
patch subject: [PATCH 3/4] riscv: uaccess: use 'asm goto' for put_user()
config: riscv-randconfig-r071-20240705 (https://download.01.org/0day-ci/archive/20240706/202407060732.wjARQ4O7-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project a0c6b8aef853eedaa0980f07c0a502a5a8a9740e)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240706/202407060732.wjARQ4O7-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407060732.wjARQ4O7-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from block/ioctl.c:4:
   In file included from include/linux/blkdev.h:9:
   In file included from include/linux/blk_types.h:10:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/riscv/include/asm/cacheflush.h:9:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> block/ioctl.c:236:9: error: expected ')'
     236 |         return put_user(val, argp);
         |                ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/ioctl.c:241:9: error: expected ')'
     241 |         return put_user(val, argp);
         |                ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/ioctl.c:246:9: error: expected ')'
     246 |         return put_user(val, argp);
         |                ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/ioctl.c:251:9: error: expected ')'
     251 |         return put_user(val, argp);
         |                ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/ioctl.c:256:9: error: expected ')'
     256 |         return put_user(val, argp);
         |                ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/ioctl.c:261:9: error: expected ')'
     261 |         return put_user(val, argp);
         |                ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
--
   In file included from block/bsg.c:8:
   In file included from include/linux/blkdev.h:9:
   In file included from include/linux/blk_types.h:10:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/riscv/include/asm/cacheflush.h:9:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> block/bsg.c:89:9: error: expected ')'
      89 |         return put_user(READ_ONCE(bd->max_queue), uarg);
         |                ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/bsg.c:125:10: error: expected ')'
     125 |                 return put_user(30527, intp);
         |                        ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/bsg.c:127:10: error: expected ')'
     127 |                 return put_user(0, intp);
         |                        ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/bsg.c:129:10: error: expected ')'
     129 |                 return put_user(0, intp);
         |                        ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/bsg.c:138:10: error: expected ')'
     138 |                 return put_user(min(bd->reserved_size, queue_max_bytes(q)),
         |                        ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   block/bsg.c:149:10: error: expected ')'
     149 |                 return put_user(1, intp);
         |                        ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
--
   In file included from fs/read_write.c:14:
   In file included from include/linux/fsnotify.h:16:
   In file included from include/linux/audit.h:13:
   In file included from include/linux/ptrace.h:10:
   In file included from include/linux/pid_namespace.h:7:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> fs/read_write.c:1340:16: error: expected ')'
    1340 |                 if (unlikely(put_user(pos, offset)))
         |                              ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   fs/read_write.c:1357:16: error: expected ')'
    1357 |                 if (unlikely(put_user(pos, offset)))
         |                              ^
   arch/riscv/include/asm/uaccess.h:301:3: note: expanded from macro 'put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   1 warning and 2 errors generated.
--
   In file included from fs/file_table.c:17:
   In file included from include/linux/security.h:33:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from fs/file_table.c:19:
>> include/linux/eventpoll.h:81:6: error: expected ')'
      81 |         if (__put_user(revents, &uevent->events) ||
         |             ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   In file included from fs/file_table.c:19:
   include/linux/eventpoll.h:82:6: error: expected ')'
      82 |             __put_user(data, &uevent->data))
         |             ^
   arch/riscv/include/asm/uaccess.h:274:2: note: expanded from macro '__put_user'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^
   arch/riscv/include/asm/uaccess.h:238:2: note: expanded from macro '__put_user_error'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^
   arch/riscv/include/asm/uaccess.h:228:3: note: expanded from macro '__put_user_nocheck'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:211:25: note: expanded from macro '__put_user_8'
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   1 warning and 2 errors generated.
..


vim +236 block/ioctl.c

66ba32dc167202c block/ioctl.c         Martin K. Petersen 2012-09-18  233  
9b81648cb5e3ae7 block/ioctl.c         Arnd Bergmann      2019-11-29  234  static int put_ushort(unsigned short __user *argp, unsigned short val)
^1da177e4c3f415 drivers/block/ioctl.c Linus Torvalds     2005-04-16  235  {
9b81648cb5e3ae7 block/ioctl.c         Arnd Bergmann      2019-11-29 @236  	return put_user(val, argp);
^1da177e4c3f415 drivers/block/ioctl.c Linus Torvalds     2005-04-16  237  }
^1da177e4c3f415 drivers/block/ioctl.c Linus Torvalds     2005-04-16  238  

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



More information about the linux-riscv mailing list