CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Xie He <[email protected]>
CC: Jakub Kicinski <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   923dcc5eb0c111eccd51cc7ce1658537e3c38b25
commit: b491e6a7391e3ecdebdd7a097550195cc878924a net: lapb: Add locking to the 
lapb module
date:   10 months ago
:::::: branch date: 14 hours ago
:::::: commit date: 10 months ago
config: riscv-randconfig-c006-20211119 (attached as .config)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b491e6a7391e3ecdebdd7a097550195cc878924a
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout b491e6a7391e3ecdebdd7a097550195cc878924a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 
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/bug.h:119:23: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                ^~~~~~~~~~~~
   drivers/spi/spi-nxp-fspi.c:849:2: note: Taking true branch
           WARN_ON(err);
           ^
   include/asm-generic/bug.h:120:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   drivers/spi/spi-nxp-fspi.c:849:2: note: Loop condition is false.  Exiting 
loop
           WARN_ON(err);
           ^
   include/asm-generic/bug.h:121:3: note: expanded from macro 'WARN_ON'
                   __WARN();                                               \
                   ^
   include/asm-generic/bug.h:94:19: note: expanded from macro '__WARN'
   #define __WARN()                __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
                                   ^
   arch/riscv/include/asm/bug.h:79:29: note: expanded from macro '__WARN_FLAGS'
   #define __WARN_FLAGS(flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags))
                               ^
   arch/riscv/include/asm/bug.h:53:32: note: expanded from macro '__BUG_FLAGS'
   #define __BUG_FLAGS(flags)                                      \
                                                                   ^
   drivers/spi/spi-nxp-fspi.c:853:2: note: Calling 'nxp_fspi_prepare_lut'
           nxp_fspi_prepare_lut(f, op);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/spi/spi-nxp-fspi.c:515:6: note: Assuming field 'nbytes' is 0
           if (op->addr.nbytes) {
               ^~~~~~~~~~~~~~~
   drivers/spi/spi-nxp-fspi.c:515:2: note: Taking false branch
           if (op->addr.nbytes) {
           ^
   drivers/spi/spi-nxp-fspi.c:523:6: note: Assuming field 'nbytes' is 0
           if (op->dummy.nbytes) {
               ^~~~~~~~~~~~~~~~
   drivers/spi/spi-nxp-fspi.c:523:2: note: Taking false branch
           if (op->dummy.nbytes) {
           ^
   drivers/spi/spi-nxp-fspi.c:536:6: note: Assuming field 'nbytes' is not equal 
to 0
           if (op->data.nbytes) {
               ^~~~~~~~~~~~~~~
   drivers/spi/spi-nxp-fspi.c:536:2: note: Taking true branch
           if (op->data.nbytes) {
           ^
   drivers/spi/spi-nxp-fspi.c:538:12: note: Assuming field 'dir' is not equal 
to SPI_MEM_DATA_IN
                                                 op->data.dir == 
SPI_MEM_DATA_IN ?
                                                 ^
   drivers/spi/spi-nxp-fspi.c:307:6: note: expanded from macro 'LUT_DEF'
           ((((ins) << INSTR_SHIFT) | ((pad) << PAD_SHIFT) | \
               ^~~
   drivers/spi/spi-nxp-fspi.c:538:12: note: '?' condition is false
                                                 op->data.dir == 
SPI_MEM_DATA_IN ?
                                                 ^
   drivers/spi/spi-nxp-fspi.c:537:25: note: The result of the left shift is 
undefined because the left operand is negative
                   lutval[lutidx / 2] |= LUT_DEF(lutidx,
                                         ^
   drivers/spi/spi-nxp-fspi.c:307:36: note: expanded from macro 'LUT_DEF'
           ((((ins) << INSTR_SHIFT) | ((pad) << PAD_SHIFT) | \
                                       ~~~~~ ^
   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.
   6 warnings generated.
   net/x25/x25_proc.c:45:20: warning: Value stored to 'rt' during its 
initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct x25_route *rt = list_entry(v, struct x25_route, node);
                             ^~
   net/x25/x25_proc.c:45:20: note: Value stored to 'rt' during its 
initialization is never read
           struct x25_route *rt = list_entry(v, struct x25_route, node);
                             ^~
   net/x25/x25_proc.c:94:26: warning: Although the value stored to 'dev' is 
used in the enclosing expression, the value is never actually read from 'dev' 
[clang-analyzer-deadcode.DeadStores]
           if (!x25->neighbour || (dev = x25->neighbour->dev) == NULL)
                                   ^     ~~~~~~~~~~~~~~~~~~~
   net/x25/x25_proc.c:94:26: note: Although the value stored to 'dev' is used 
in the enclosing expression, the value is never actually read from 'dev'
           if (!x25->neighbour || (dev = x25->neighbour->dev) == NULL)
                                   ^     ~~~~~~~~~~~~~~~~~~~
   net/x25/x25_proc.c:133:22: warning: Value stored to 'f' during its 
initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct x25_forward *f = list_entry(v, struct x25_forward, node);
                               ^
   net/x25/x25_proc.c:133:22: note: Value stored to 'f' during its 
initialization is never read
           struct x25_forward *f = list_entry(v, struct x25_forward, node);
                               ^
   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.
   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.
   5 warnings generated.
>> arch/riscv/include/asm/atomic.h:30:9: warning: Use of memory after it is 
>> freed [clang-analyzer-unix.Malloc]
           return READ_ONCE(v->counter);
                  ^
   include/asm-generic/rwonce.h:50:2: note: expanded from macro 'READ_ONCE'
           __READ_ONCE(x);                                                 \
           ^
   include/asm-generic/rwonce.h:44:24: note: expanded from macro '__READ_ONCE'
   #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
                           ^
   net/lapb/lapb_iface.c:181:6: note: Assuming 'lapb' is non-null
           if (!lapb)
               ^~~~~
   net/lapb/lapb_iface.c:181:2: note: Taking false branch
           if (!lapb)
           ^
   net/lapb/lapb_iface.c:183:2: note: Calling 'lapb_put'
           lapb_put(lapb);
           ^~~~~~~~~~~~~~
   net/lapb/lapb_iface.c:57:2: note: Taking true branch
           if (refcount_dec_and_test(&lapb->refcnt))
           ^
   net/lapb/lapb_iface.c:58:3: note: Calling 'lapb_free_cb'
                   lapb_free_cb(lapb);
                   ^~~~~~~~~~~~~~~~~~
   net/lapb/lapb_iface.c:47:2: note: Memory is released
           kfree(lapb);
           ^~~~~~~~~~~
   net/lapb/lapb_iface.c:58:3: note: Returning; memory was released via 1st 
parameter
                   lapb_free_cb(lapb);
                   ^~~~~~~~~~~~~~~~~~
   net/lapb/lapb_iface.c:183:2: note: Returning; memory was released via 1st 
parameter
           lapb_put(lapb);
           ^~~~~~~~~~~~~~
   net/lapb/lapb_iface.c:186:9: note: Calling 'refcount_read'
           while (refcount_read(&lapb->refcnt) > 2)
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/refcount.h:147:9: note: Calling 'atomic_read'
           return atomic_read(&r->refs);
                  ^~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/atomic.h:30:9: note: Left side of '||' is false
           return READ_ONCE(v->counter);
                  ^
   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:282:3: note: expanded from macro 
'__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   arch/riscv/include/asm/atomic.h:30:9: note: Left side of '||' is false
           return READ_ONCE(v->counter);
                  ^
   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:282:3: note: expanded from macro 
'__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   arch/riscv/include/asm/atomic.h:30:9: note: Left side of '||' is true
           return READ_ONCE(v->counter);
                  ^
   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:283:28: note: expanded from macro 
'__native_word'
            sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
                                     ^
   arch/riscv/include/asm/atomic.h:30:9: note: Taking false branch
           return READ_ONCE(v->counter);
                  ^
   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:320:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:308:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   arch/riscv/include/asm/atomic.h:30:9: note: Loop condition is false.  
Exiting loop
           return READ_ONCE(v->counter);
                  ^
   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),  \

vim +30 arch/riscv/include/asm/atomic.h

fab957c11efe2f Palmer Dabbelt 2017-07-10  21  
fd2efaa4eb5317 Mark Rutland   2018-07-16  22  #define __atomic_acquire_fence()  
                                \
fd2efaa4eb5317 Mark Rutland   2018-07-16  23    __asm__ 
__volatile__(RISCV_ACQUIRE_BARRIER "" ::: "memory")
fd2efaa4eb5317 Mark Rutland   2018-07-16  24  
fd2efaa4eb5317 Mark Rutland   2018-07-16  25  #define __atomic_release_fence()  
                                \
fd2efaa4eb5317 Mark Rutland   2018-07-16  26    __asm__ 
__volatile__(RISCV_RELEASE_BARRIER "" ::: "memory");
5ce6c1f3535fa8 Andrea Parri   2018-03-09  27  
fab957c11efe2f Palmer Dabbelt 2017-07-10  28  static __always_inline int 
atomic_read(const atomic_t *v)
fab957c11efe2f Palmer Dabbelt 2017-07-10  29  {
fab957c11efe2f Palmer Dabbelt 2017-07-10 @30    return READ_ONCE(v->counter);
fab957c11efe2f Palmer Dabbelt 2017-07-10  31  }
fab957c11efe2f Palmer Dabbelt 2017-07-10  32  static __always_inline void 
atomic_set(atomic_t *v, int i)
fab957c11efe2f Palmer Dabbelt 2017-07-10  33  {
fab957c11efe2f Palmer Dabbelt 2017-07-10  34    WRITE_ONCE(v->counter, i);
fab957c11efe2f Palmer Dabbelt 2017-07-10  35  }
fab957c11efe2f Palmer Dabbelt 2017-07-10  36  

:::::: The code at line 30 was first introduced by commit
:::::: fab957c11efe2f405e08b9f0d080524bc2631428 RISC-V: Atomic and Locking Code

:::::: TO: Palmer Dabbelt <[email protected]>
:::::: CC: Palmer Dabbelt <[email protected]>

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