CC: [email protected]
CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: Mark Rutland <[email protected]>
CC: Peter Zijlstra <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   9d004b2f4fea97cde123e7f1939b80e77bf2e695
commit: 67d1b0de258ad066e1fc85d0ceaa75e107fb45bb locking/atomic: add 
arch_atomic_long*()
date:   11 months ago
:::::: branch date: 21 hours ago
:::::: commit date: 11 months ago
config: arm-randconfig-c002-20220529 
(https://download.01.org/0day-ci/archive/20220529/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
0fbe3f3f486e01448121f7931a4ca29fac1504ab)
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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=67d1b0de258ad066e1fc85d0ceaa75e107fb45bb
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 67d1b0de258ad066e1fc85d0ceaa75e107fb45bb
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 
clang-analyzer 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
                                                           
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/dvb-frontends/stb0899_algo.c:392:3: note: Taking true branch
                   if ((internal->status != CARRIEROK) || 
(stb0899_check_data(state) != DATAOK)) {
                   ^
   drivers/media/dvb-frontends/stb0899_algo.c:395:8: note: Assuming '__x' is >= 0
                           if (abs(derot_freq) > derot_limit)
                               ^
   include/linux/math.h:134:3: note: expanded from macro 'abs'
                   __abs_choose_expr(x, short,                             \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/math.h:144:28: note: expanded from macro '__abs_choose_expr'
           ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
                                     ^~~~~~~
   include/linux/math.h:144:54: note: expanded from macro '__abs_choose_expr'
           ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
                                                               ^~~~~
   include/linux/math.h:144:54: note: expanded from macro '__abs_choose_expr'
           ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
                                                               ^~~~~
   include/linux/math.h:144:54: note: expanded from macro '__abs_choose_expr'
           ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
                                                               ^~~~~
   drivers/media/dvb-frontends/stb0899_algo.c:395:8: note: '?' condition is 
false
                           if (abs(derot_freq) > derot_limit)
                               ^
   include/linux/math.h:134:3: note: expanded from macro 'abs'
                   __abs_choose_expr(x, short,                             \
                   ^
   include/linux/math.h:144:28: note: expanded from macro '__abs_choose_expr'
           ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
                                     ^
   drivers/media/dvb-frontends/stb0899_algo.c:395:8: note: Assuming the 
condition is false
                           if (abs(derot_freq) > derot_limit)
                               ^
   include/linux/math.h:131:16: note: expanded from macro 'abs'
   #define abs(x)  __abs_choose_expr(x, long long,                         \
                   ^
   include/linux/math.h:141:43: note: expanded from macro '__abs_choose_expr'
   #define __abs_choose_expr(x, type, other) __builtin_choose_expr(        \
                                             ^
   drivers/media/dvb-frontends/stb0899_algo.c:395:4: note: Taking false branch
                           if (abs(derot_freq) > derot_limit)
                           ^
   drivers/media/dvb-frontends/stb0899_algo.c:398:8: note: 'next_loop' is 3
                           if (next_loop) {
                               ^~~~~~~~~
   drivers/media/dvb-frontends/stb0899_algo.c:398:4: note: Taking true branch
                           if (next_loop) {
                           ^
   drivers/media/dvb-frontends/stb0899_algo.c:399:5: note: Taking true branch
                                   dprintk(state->verbose, FE_DEBUG, 1, "Derot 
freq=%d, mclk=%d", derot_freq, internal->mclk);
                                   ^
   drivers/media/dvb-frontends/stb0899_priv.h:23:2: note: expanded from macro 
'dprintk'
           if (z) {                                                             
           \
           ^
   drivers/media/dvb-frontends/stb0899_algo.c:399:5: note: Assuming the 
condition is true
                                   dprintk(state->verbose, FE_DEBUG, 1, "Derot 
freq=%d, mclk=%d", derot_freq, internal->mclk);
                                   ^
   drivers/media/dvb-frontends/stb0899_priv.h:24:8: note: expanded from macro 
'dprintk'
                   if      ((*x > FE_ERROR) && (*x > y))                        
           \
                             ^~~~~~~~~~~~~
   drivers/media/dvb-frontends/stb0899_algo.c:399:5: note: Left side of '&&' is 
true
                                   dprintk(state->verbose, FE_DEBUG, 1, "Derot 
freq=%d, mclk=%d", derot_freq, internal->mclk);
                                   ^
   drivers/media/dvb-frontends/stb0899_priv.h:24:7: note: expanded from macro 
'dprintk'
                   if      ((*x > FE_ERROR) && (*x > y))                        
           \
                            ^
   drivers/media/dvb-frontends/stb0899_algo.c:399:5: note: Assuming the 
condition is true
                                   dprintk(state->verbose, FE_DEBUG, 1, "Derot 
freq=%d, mclk=%d", derot_freq, internal->mclk);
                                   ^
   drivers/media/dvb-frontends/stb0899_priv.h:24:27: note: expanded from macro 
'dprintk'
                   if      ((*x > FE_ERROR) && (*x > y))                        
           \
                                                ^~~~~~
   drivers/media/dvb-frontends/stb0899_algo.c:399:5: note: Taking true branch
                                   dprintk(state->verbose, FE_DEBUG, 1, "Derot 
freq=%d, mclk=%d", derot_freq, internal->mclk);
                                   ^
   drivers/media/dvb-frontends/stb0899_priv.h:24:3: note: expanded from macro 
'dprintk'
                   if      ((*x > FE_ERROR) && (*x > y))                        
           \
                   ^
   drivers/media/dvb-frontends/stb0899_algo.c:399:5: note: Loop condition is 
false.  Exiting loop
                                   dprintk(state->verbose, FE_DEBUG, 1, "Derot 
freq=%d, mclk=%d", derot_freq, internal->mclk);
                                   ^
   drivers/media/dvb-frontends/stb0899_priv.h:22:42: note: expanded from macro 
'dprintk'
   #define dprintk(x, y, z, format, arg...) do {                                
           \
                                            ^
   drivers/media/dvb-frontends/stb0899_algo.c:404:5: note: The left operand of 
'&' is a garbage value
                                   STB0899_SETFIELD_VAL(CFRM, cfr[0], 
MSB(internal->inversion * derot_freq));
                                   ^
   drivers/media/dvb-frontends/stb0899_priv.h:61:61: note: expanded from macro 
'STB0899_SETFIELD_VAL'
   #define STB0899_SETFIELD_VAL(bitf, mask, val)   (mask = (mask & (~(((1 << 
STB0899_WIDTH_##bitf) - 1) <<\
                                                            ~~~~ ^
   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.
   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.
>> include/linux/atomic/atomic-long.h:523:9: warning: Dereference of null 
>> pointer [clang-analyzer-core.NullDereference]
           return arch_atomic_read(v);
                  ^
   arch/arm/include/asm/atomic.h:25:29: note: expanded from macro 
'arch_atomic_read'
   #define arch_atomic_read(v)     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))
                           ^
   mm/memcontrol.c:6182:26: note: Passing null pointer value via 2nd parameter 
'events'
           __memory_events_show(m, memcg->memory_events_local);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/memcontrol.c:6182:2: note: Calling '__memory_events_show'
           __memory_events_show(m, memcg->memory_events_local);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/memcontrol.c:6162:46: note: Passing null pointer value via 1st parameter 
'v'
           seq_printf(m, "low %lu\n", atomic_long_read(&events[MEMCG_LOW]));
                                                       ^~~~~~~~~~~~~~~~~~
   mm/memcontrol.c:6162:29: note: Calling 'atomic_long_read'
           seq_printf(m, "low %lu\n", atomic_long_read(&events[MEMCG_LOW]));
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:1184:31: note: Passing null 
pointer value via 1st parameter 'v'
           return arch_atomic_long_read(v);
                                        ^
   include/linux/atomic/atomic-instrumented.h:1184:9: note: Calling 
'arch_atomic_long_read'
           return arch_atomic_long_read(v);
                  ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-long.h:523:9: note: Left side of '||' is false
           return arch_atomic_read(v);
                  ^
   arch/arm/include/asm/atomic.h:25:29: note: expanded from macro 
'arch_atomic_read'
   #define arch_atomic_read(v)     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:290:3: note: expanded from macro 
'__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   include/linux/atomic/atomic-long.h:523:9: note: Left side of '||' is false
           return arch_atomic_read(v);
                  ^
   arch/arm/include/asm/atomic.h:25:29: note: expanded from macro 
'arch_atomic_read'
   #define arch_atomic_read(v)     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:290:3: note: expanded from macro 
'__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   include/linux/atomic/atomic-long.h:523:9: note: Left side of '||' is true
           return arch_atomic_read(v);
                  ^
   arch/arm/include/asm/atomic.h:25:29: note: expanded from macro 
'arch_atomic_read'
   #define arch_atomic_read(v)     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:291:28: note: expanded from macro 
'__native_word'
            sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
                                     ^
   include/linux/atomic/atomic-long.h:523:9: note: Taking false branch
           return arch_atomic_read(v);
                  ^
   arch/arm/include/asm/atomic.h:25:29: note: expanded from macro 
'arch_atomic_read'
   #define arch_atomic_read(v)     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: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))                                       \
                   ^
   include/linux/atomic/atomic-long.h:523:9: note: Loop condition is false.  
Exiting loop
           return arch_atomic_read(v);
                  ^
   arch/arm/include/asm/atomic.h:25:29: note: expanded from macro 
'arch_atomic_read'
   #define arch_atomic_read(v)     READ_ONCE((v)->counter)

vim +523 include/linux/atomic/atomic-long.h

b5d47ef9ea5c5f include/asm-generic/atomic-long.h  Mark Rutland 2018-09-04  519  
c020395b6634b7 include/asm-generic/atomic-long.h  Marco Elver  2019-11-26  520  
static __always_inline long
67d1b0de258ad0 include/linux/atomic/atomic-long.h Mark Rutland 2021-07-13  521  
arch_atomic_long_read(const atomic_long_t *v)
b5d47ef9ea5c5f include/asm-generic/atomic-long.h  Mark Rutland 2018-09-04  522  
{
67d1b0de258ad0 include/linux/atomic/atomic-long.h Mark Rutland 2021-07-13 @523  
        return arch_atomic_read(v);
b5d47ef9ea5c5f include/asm-generic/atomic-long.h  Mark Rutland 2018-09-04  524  
}
b5d47ef9ea5c5f include/asm-generic/atomic-long.h  Mark Rutland 2018-09-04  525  

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

Reply via email to