CC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Hamza Mahfooz <[email protected]>
TO: [email protected]
CC: Hamza Mahfooz <[email protected]>
CC: Benjamin LaHaise <[email protected]>
CC: Alexander Viro <[email protected]>
CC: [email protected]
CC: [email protected]

Hi Hamza,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on linux/master v5.15-rc1 next-20210916]
[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/Hamza-Mahfooz/aio-convert-active_reqs-into-a-hashtable/20210914-174924
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
d0ee23f9d78be5531c4b055ea424ed0b489dfe9b
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: arm-randconfig-c002-20210916 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
8cbbd7e0b2aa21ce7e416cfb63d9965518948c35)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # 
https://github.com/0day-ci/linux/commit/ab7dca103bc74aed4baada06420395f4bead4e6c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Hamza-Mahfooz/aio-convert-active_reqs-into-a-hashtable/20210914-174924
        git checkout ab7dca103bc74aed4baada06420395f4bead4e6c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 
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 >>)
   17 warnings generated.
   Suppressed 17 warnings (17 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   18 warnings generated.
   Suppressed 18 warnings (18 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.
   18 warnings generated.
   Suppressed 18 warnings (18 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   3 warnings generated.
   drivers/pinctrl/visconti/pinctrl-common.c:224:38: warning: Value stored to 
'func' during its initialization is never read 
[clang-analyzer-deadcode.DeadStores]
           const struct visconti_pin_function *func = 
&priv->devdata->functions[function];
                                               ^~~~   
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/visconti/pinctrl-common.c:224:38: note: Value stored to 
'func' during its initialization is never read
           const struct visconti_pin_function *func = 
&priv->devdata->functions[function];
                                               ^~~~   
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   20 warnings generated.
   fs/aio.c:1543:2: warning: Value stored to 'ret' is never read 
[clang-analyzer-deadcode.DeadStores]
           ret = -EINVAL;
           ^     ~~~~~~~
   fs/aio.c:1543:2: note: Value stored to 'ret' is never read
           ret = -EINVAL;
           ^     ~~~~~~~
>> fs/aio.c:2042:36: warning: Dereference of undefined pointer value 
>> [clang-analyzer-core.NullDereference]
           list = &ctx->active_reqs[hash_min(kiocb->ki_res.obj, 
ctx->hash_bits)];
                                             ^
   fs/aio.c:2020:1: note: Calling '__do_sys_io_cancel'
   SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb,
   ^
   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/aio.c:2024:2: note: 'kiocb' declared without an initial value
           struct aio_kiocb *kiocb;
           ^~~~~~~~~~~~~~~~~~~~~~~
   fs/aio.c:2031:15: note: Control jumps to 'case 4:'  at line 2031
           if (unlikely(get_user(key, &iocb->aio_key)))
                        ^
   arch/arm/include/asm/uaccess.h:214:3: note: expanded from macro 'get_user'
                   __get_user_check(x, p);                                 \
                   ^
   arch/arm/include/asm/uaccess.h:179:3: note: expanded from macro 
'__get_user_check'
                   switch (sizeof(*(__p))) {                               \
                   ^
   fs/aio.c:2031:15: note: Taking false branch
           if (unlikely(get_user(key, &iocb->aio_key)))
                        ^
   arch/arm/include/asm/uaccess.h:214:3: note: expanded from macro 'get_user'
                   __get_user_check(x, p);                                 \
                   ^
   arch/arm/include/asm/uaccess.h:193:4: note: expanded from macro 
'__get_user_check'
                           if (sizeof((x)) >= 8)                           \
                           ^
   fs/aio.c:2031:15: note:  Execution continues on line 2031
           if (unlikely(get_user(key, &iocb->aio_key)))
                        ^
   arch/arm/include/asm/uaccess.h:214:3: note: expanded from macro 'get_user'
                   __get_user_check(x, p);                                 \
                   ^
   arch/arm/include/asm/uaccess.h:197:4: note: expanded from macro 
'__get_user_check'
                           break;                                          \
                           ^
   fs/aio.c:2031:6: note: Assuming the condition is false
           if (unlikely(get_user(key, &iocb->aio_key)))
               ^
   include/linux/compiler.h:78:22: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/aio.c:2031:2: note: Taking false branch
           if (unlikely(get_user(key, &iocb->aio_key)))
           ^
   fs/aio.c:2033:15: note: Assuming 'key' is equal to 0
           if (unlikely(key != KIOCB_KEY))
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   fs/aio.c:2033:2: note: Taking false branch
           if (unlikely(key != KIOCB_KEY))
           ^
   fs/aio.c:2037:16: note: 'ctx' is non-null
           if (unlikely(!ctx))
                         ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   fs/aio.c:2037:2: note: Taking false branch
           if (unlikely(!ctx))
           ^
   fs/aio.c:2042:27: note: '?' condition is false
           list = &ctx->active_reqs[hash_min(kiocb->ki_res.obj, 
ctx->hash_bits)];
                                    ^
   include/linux/hashtable.h:32:3: note: expanded from macro 'hash_min'
           (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits))
            ^
   fs/aio.c:2042:36: note: Dereference of undefined pointer value
           list = &ctx->active_reqs[hash_min(kiocb->ki_res.obj, 
ctx->hash_bits)];
                                             ^
   include/linux/hashtable.h:32:53: note: expanded from macro 'hash_min'
           (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits))
                                                              ^~~
   include/linux/hash.h:16:38: note: expanded from macro 'hash_long'
   #define hash_long(val, bits) hash_32(val, bits)
                                        ^~~
   Suppressed 18 warnings (17 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   19 warnings generated.
   drivers/gpio/gpiolib-cdev.c:1266:4: warning: Value stored to 'ret' is never 
read [clang-analyzer-deadcode.DeadStores]
                           ret = -EIO;
                           ^     ~~~~
   drivers/gpio/gpiolib-cdev.c:1266:4: note: Value stored to 'ret' is never read
                           ret = -EIO;
                           ^     ~~~~
   drivers/gpio/gpiolib-cdev.c:2243:4: warning: Value stored to 'ret' is never 
read [clang-analyzer-deadcode.DeadStores]
                           ret = -EIO;
                           ^     ~~~~
   drivers/gpio/gpiolib-cdev.c:2243:4: note: Value stored to 'ret' is never read

vim +2042 fs/aio.c

c00d2c7e898800 Al Viro           2016-12-20  2009  
^1da177e4c3f41 Linus Torvalds    2005-04-16  2010  /* sys_io_cancel:
^1da177e4c3f41 Linus Torvalds    2005-04-16  2011   *   Attempts to cancel an 
iocb previously passed to io_submit.  If
^1da177e4c3f41 Linus Torvalds    2005-04-16  2012   *   the operation is 
successfully cancelled, the resulting event is
^1da177e4c3f41 Linus Torvalds    2005-04-16  2013   *   copied into the memory 
pointed to by result without being placed
^1da177e4c3f41 Linus Torvalds    2005-04-16  2014   *   into the completion 
queue and 0 is returned.  May fail with
^1da177e4c3f41 Linus Torvalds    2005-04-16  2015   *   -EFAULT if any of the 
data structures pointed to are invalid.
^1da177e4c3f41 Linus Torvalds    2005-04-16  2016   *   May fail with -EINVAL 
if aio_context specified by ctx_id is
^1da177e4c3f41 Linus Torvalds    2005-04-16  2017   *   invalid.  May fail with 
-EAGAIN if the iocb specified was not
^1da177e4c3f41 Linus Torvalds    2005-04-16  2018   *   cancelled.  Will fail 
with -ENOSYS if not implemented.
^1da177e4c3f41 Linus Torvalds    2005-04-16  2019   */
002c8976ee5377 Heiko Carstens    2009-01-14  2020  SYSCALL_DEFINE3(io_cancel, 
aio_context_t, ctx_id, struct iocb __user *, iocb,
002c8976ee5377 Heiko Carstens    2009-01-14  2021               struct io_event 
__user *, result)
^1da177e4c3f41 Linus Torvalds    2005-04-16  2022  {
^1da177e4c3f41 Linus Torvalds    2005-04-16  2023       struct kioctx *ctx;
04b2fa9f8f36ec Christoph Hellwig 2015-02-02  2024       struct aio_kiocb *kiocb;
888933f8fdf06e Christoph Hellwig 2018-05-23  2025       int ret = -EINVAL;
^1da177e4c3f41 Linus Torvalds    2005-04-16  2026       u32 key;
ab7dca103bc74a Hamza Mahfooz     2021-09-14  2027       struct hlist_head *list;
ab7dca103bc74a Hamza Mahfooz     2021-09-14  2028       struct hlist_node *node;
a9339b7855094b Al Viro           2019-03-07  2029       u64 obj = 
(u64)(unsigned long)iocb;
^1da177e4c3f41 Linus Torvalds    2005-04-16  2030  
f3a2752a43de18 Christoph Hellwig 2018-03-30  2031       if 
(unlikely(get_user(key, &iocb->aio_key)))
^1da177e4c3f41 Linus Torvalds    2005-04-16  2032               return -EFAULT;
f3a2752a43de18 Christoph Hellwig 2018-03-30  2033       if (unlikely(key != 
KIOCB_KEY))
f3a2752a43de18 Christoph Hellwig 2018-03-30  2034               return -EINVAL;
^1da177e4c3f41 Linus Torvalds    2005-04-16  2035  
^1da177e4c3f41 Linus Torvalds    2005-04-16  2036       ctx = 
lookup_ioctx(ctx_id);
^1da177e4c3f41 Linus Torvalds    2005-04-16  2037       if (unlikely(!ctx))
^1da177e4c3f41 Linus Torvalds    2005-04-16  2038               return -EINVAL;
^1da177e4c3f41 Linus Torvalds    2005-04-16  2039  
^1da177e4c3f41 Linus Torvalds    2005-04-16  2040       
spin_lock_irq(&ctx->ctx_lock);
ab7dca103bc74a Hamza Mahfooz     2021-09-14  2041  
ab7dca103bc74a Hamza Mahfooz     2021-09-14 @2042       list = 
&ctx->active_reqs[hash_min(kiocb->ki_res.obj, ctx->hash_bits)];
ab7dca103bc74a Hamza Mahfooz     2021-09-14  2043  
ab7dca103bc74a Hamza Mahfooz     2021-09-14  2044       
hlist_for_each_entry_safe(kiocb, node, list, ki_node) {
a9339b7855094b Al Viro           2019-03-07  2045               if 
(kiocb->ki_res.obj == obj) {
888933f8fdf06e Christoph Hellwig 2018-05-23  2046                       ret = 
kiocb->ki_cancel(&kiocb->rw);
ab7dca103bc74a Hamza Mahfooz     2021-09-14  2047                       
hash_del(&kiocb->ki_node);
833f4154ed5602 Al Viro           2019-03-11  2048                       break;
833f4154ed5602 Al Viro           2019-03-11  2049               }
888933f8fdf06e Christoph Hellwig 2018-05-23  2050       }
ab7dca103bc74a Hamza Mahfooz     2021-09-14  2051  
^1da177e4c3f41 Linus Torvalds    2005-04-16  2052       
spin_unlock_irq(&ctx->ctx_lock);
^1da177e4c3f41 Linus Torvalds    2005-04-16  2053  
^1da177e4c3f41 Linus Torvalds    2005-04-16  2054       if (!ret) {
bec68faaf3ba74 Kent Overstreet   2013-05-13  2055               /*
bec68faaf3ba74 Kent Overstreet   2013-05-13  2056                * The result 
argument is no longer used - the io_event is
bec68faaf3ba74 Kent Overstreet   2013-05-13  2057                * always 
delivered via the ring buffer. -EINPROGRESS indicates
bec68faaf3ba74 Kent Overstreet   2013-05-13  2058                * cancellation 
is progress:
^1da177e4c3f41 Linus Torvalds    2005-04-16  2059                */
bec68faaf3ba74 Kent Overstreet   2013-05-13  2060               ret = 
-EINPROGRESS;
^1da177e4c3f41 Linus Torvalds    2005-04-16  2061       }
^1da177e4c3f41 Linus Torvalds    2005-04-16  2062  
723be6e39d1425 Kent Overstreet   2013-05-28  2063       
percpu_ref_put(&ctx->users);
^1da177e4c3f41 Linus Torvalds    2005-04-16  2064  
^1da177e4c3f41 Linus Torvalds    2005-04-16  2065       return ret;
^1da177e4c3f41 Linus Torvalds    2005-04-16  2066  }
^1da177e4c3f41 Linus Torvalds    2005-04-16  2067  

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