CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Jens Axboe <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
io_uring-fops.v6
head:   7bc1512cfe9524af44acbc3241d8f906fbf96d1c
commit: 55d951dde80fdc6d6ac4dda628432393fcfca90f [34/38] io_uring: add support 
for IORING_OP_URING_CMD
:::::: branch date: 23 hours ago
:::::: commit date: 23 hours ago
config: x86_64-randconfig-c001-20210808 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
614c7d03877fd99c2de47429b15be3f00306a3bd)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=55d951dde80fdc6d6ac4dda628432393fcfca90f
        git remote add block 
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
        git fetch --no-tags block io_uring-fops.v6
        git checkout 55d951dde80fdc6d6ac4dda628432393fcfca90f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
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 >>)
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 
'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long 
long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro 
'__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   fs/io_uring.c:6652:16: note: Left side of '||' is true
           personality = READ_ONCE(*pptr);
                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 
'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long 
long),  \
                              ^
   include/linux/compiler_types.h:290:59: note: expanded from macro 
'__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
                                                                    ^
   fs/io_uring.c:6652:16: note: Taking false branch
           personality = READ_ONCE(*pptr);
                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:2: note: expanded from macro 
'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long 
long),  \
           ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   fs/io_uring.c:6652:16: note: Loop condition is false.  Exiting loop
           personality = READ_ONCE(*pptr);
                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:2: note: expanded from macro 
'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long 
long),  \
           ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   fs/io_uring.c:6653:6: note: Assuming 'personality' is 0
           if (personality) {
               ^~~~~~~~~~~
   fs/io_uring.c:6653:2: note: Taking false branch
           if (personality) {
           ^
   fs/io_uring.c:6666:14: note: Field 'plug_started' is false
           if (!state->plug_started && state->ios_left > 1 && def->plug) {
                       ^
   fs/io_uring.c:6666:6: note: Left side of '&&' is true
           if (!state->plug_started && state->ios_left > 1 && def->plug) {
               ^
   fs/io_uring.c:6666:30: note: Assuming field 'ios_left' is <= 1
           if (!state->plug_started && state->ios_left > 1 && def->plug) {
                                       ^~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:6666:50: note: Left side of '&&' is false
           if (!state->plug_started && state->ios_left > 1 && def->plug) {
                                                           ^
   fs/io_uring.c:6671:6: note: Assuming field 'needs_file' is 0
           if (def->needs_file) {
               ^~~~~~~~~~~~~~~
   fs/io_uring.c:6671:2: note: Taking false branch
           if (def->needs_file) {
           ^
   fs/io_uring.c:6689:8: note: Returning from 'io_init_req'
           ret = io_init_req(ctx, req, &sqe->hdr);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:6690:2: note: Taking false branch
           if (unlikely(ret)) {
           ^
   fs/io_uring.c:6702:8: note: Calling 'io_req_prep'
           ret = io_req_prep(req, sqe);
                 ^~~~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:5964:2: note: Control jumps to 'case IORING_OP_WRITE:'  at 
line 5973
           switch (req->opcode) {
           ^
   fs/io_uring.c:5974:10: note: Calling 'io_write_prep'
                   return io_write_prep(req, sqe);
                          ^~~~~~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:3390:17: note: Access to field 'f_mode' results in a 
dereference of a null pointer (loaded from field 'file')
           if (unlikely(!(req->file->f_mode & FMODE_WRITE)))
                          ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
>> fs/io_uring.c:3608:7: warning: Access to field 'f_op' results in a 
>> dereference of a null pointer (loaded from field 'file') 
>> [clang-analyzer-core.NullDereference]
           if (!req->file->f_op->uring_cmd)
                ^
   fs/io_uring.c:9395:1: note: Calling '__se_sys_io_uring_enter'
   SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
   ^
   include/linux/syscalls.h:221:36: note: expanded from macro 'SYSCALL_DEFINE6'
   #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:227:2: note: expanded from macro 'SYSCALL_DEFINEx'
           __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:231:2: note: expanded from macro 
'__SYSCALL_DEFINEx'
           __X64_SYS_STUBx(x, name, __VA_ARGS__)                           \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:97:2: note: expanded from macro 
'__X64_SYS_STUBx'
           __SYS_STUBx(x64, sys##name,                                     \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:79:10: note: expanded from macro 
'__SYS_STUBx'
                   return __se_##name(__VA_ARGS__);                        \
                          ^~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   fs/io_uring.c:9395:1: note: Calling '__do_sys_io_uring_enter'
   SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
   ^
   include/linux/syscalls.h:221:36: note: expanded from macro 'SYSCALL_DEFINE6'
   #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:227:2: note: expanded from macro 'SYSCALL_DEFINEx'
           __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:235:14: note: expanded from macro 
'__SYSCALL_DEFINEx'
                   long ret = __do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__));\
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   fs/io_uring.c:9406:6: note: Assuming the condition is true
           if (unlikely(flags & ~(IORING_ENTER_GETEVENTS | 
IORING_ENTER_SQ_WAKEUP |
               ^
   include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                             ^~~~
   fs/io_uring.c:9406:2: note: Taking false branch
           if (unlikely(flags & ~(IORING_ENTER_GETEVENTS | 
IORING_ENTER_SQ_WAKEUP |
           ^
   fs/io_uring.c:9411:6: note: Assuming the condition is false
           if (unlikely(!f.file))
               ^
   include/linux/compiler.h:78:22: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:9411:2: note: Taking false branch
           if (unlikely(!f.file))
           ^
   fs/io_uring.c:9415:6: note: Assuming the condition is false
           if (unlikely(f.file->f_op != &io_uring_fops))
               ^
   include/linux/compiler.h:78:22: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:9415:2: note: Taking false branch
           if (unlikely(f.file->f_op != &io_uring_fops))
           ^
   fs/io_uring.c:9420:2: note: Taking false branch
           if (unlikely(!percpu_ref_tryget(&ctx->refs)))
           ^
   fs/io_uring.c:9424:6: note: Assuming the condition is true
           if (unlikely(ctx->flags & IORING_SETUP_R_DISABLED))
               ^
   include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                             ^~~~
   fs/io_uring.c:9424:2: note: Taking false branch
           if (unlikely(ctx->flags & IORING_SETUP_R_DISABLED))
           ^
   fs/io_uring.c:9433:6: note: Assuming the condition is false
           if (ctx->flags & IORING_SETUP_SQPOLL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:9433:2: note: Taking false branch
           if (ctx->flags & IORING_SETUP_SQPOLL) {
           ^
   fs/io_uring.c:9447:13: note: Assuming 'to_submit' is not equal to 0
           } else if (to_submit) {
                      ^~~~~~~~~
   fs/io_uring.c:9447:9: note: Taking true branch
           } else if (to_submit) {
                  ^
   fs/io_uring.c:9449:3: note: Taking false branch
                   if (unlikely(ret))
                   ^
   fs/io_uring.c:9452:15: note: Calling 'io_submit_sqes'
                   submitted = io_submit_sqes(ctx, to_submit);
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/io_uring.c:6823:7: note: Assuming '__UNIQUE_ID___x1880' is >= 
'__UNIQUE_ID___y1881'
           nr = min3(nr, ctx->sq_entries, io_sqring_entries(ctx));
                ^
   include/linux/minmax.h:60:38: note: expanded from macro 'min3'
   #define min3(x, y, z) min((typeof(x))min(x, y), z)
                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^

vim +3608 fs/io_uring.c

55d951dde80fdc6 Jens Axboe 2021-03-17  3601  
55d951dde80fdc6 Jens Axboe 2021-03-17  3602  static int 
io_uring_cmd_prep(struct io_kiocb *req,
55d951dde80fdc6 Jens Axboe 2021-03-17  3603                          const 
struct io_uring_sqe *sqe)
55d951dde80fdc6 Jens Axboe 2021-03-17  3604  {
55d951dde80fdc6 Jens Axboe 2021-03-17  3605     const struct io_uring_cmd_sqe 
*csqe = (const void *) sqe;
55d951dde80fdc6 Jens Axboe 2021-03-17  3606     struct io_uring_cmd *cmd = 
&req->uring_cmd;
55d951dde80fdc6 Jens Axboe 2021-03-17  3607  
55d951dde80fdc6 Jens Axboe 2021-03-17 @3608     if (!req->file->f_op->uring_cmd)
55d951dde80fdc6 Jens Axboe 2021-03-17  3609             return -EOPNOTSUPP;
55d951dde80fdc6 Jens Axboe 2021-03-17  3610  
55d951dde80fdc6 Jens Axboe 2021-03-17  3611     cmd->op = READ_ONCE(csqe->op);
55d951dde80fdc6 Jens Axboe 2021-03-17  3612     cmd->len = READ_ONCE(csqe->len);
55d951dde80fdc6 Jens Axboe 2021-03-17  3613  
55d951dde80fdc6 Jens Axboe 2021-03-17  3614     /*
55d951dde80fdc6 Jens Axboe 2021-03-17  3615      * The payload is the last 40 
bytes of an io_uring_cmd_sqe, with the
55d951dde80fdc6 Jens Axboe 2021-03-17  3616      * type being defined by the 
recipient.
55d951dde80fdc6 Jens Axboe 2021-03-17  3617      */
55d951dde80fdc6 Jens Axboe 2021-03-17  3618     memcpy(&cmd->pdu, &csqe->pdu, 
sizeof(cmd->pdu));
55d951dde80fdc6 Jens Axboe 2021-03-17  3619     return 0;
55d951dde80fdc6 Jens Axboe 2021-03-17  3620  }
55d951dde80fdc6 Jens Axboe 2021-03-17  3621  

---
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