All of lore.kernel.org
 help / color / mirror / Atom feed
* [tip:locking/core 20/23] include/linux/atomic/atomic-long.h:523:9: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
@ 2021-08-19  3:49 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-19  3:49 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 14400 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
CC: x86(a)kernel.org
TO: Mark Rutland <mark.rutland@arm.com>
CC: Peter Zijlstra <peterz@infradead.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
head:   55bccf1f93e4bf1b3209cc8648ab53f10f4601a5
commit: 67d1b0de258ad066e1fc85d0ceaa75e107fb45bb [20/23] locking/atomic: add arch_atomic_long*()
:::::: branch date: 2 weeks ago
:::::: commit date: 5 weeks ago
config: arm-randconfig-c002-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
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/tip/tip.git/commit/?id=67d1b0de258ad066e1fc85d0ceaa75e107fb45bb
        git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
        git fetch --no-tags tip locking/core
        git checkout 67d1b0de258ad066e1fc85d0ceaa75e107fb45bb
        # 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 <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                                                     ^~~
   drivers/media/i2c/tda1997x.c:1979:5: note: '?' condition is true
                     (avi->colorspace == HDMI_COLORSPACE_RGB) ? "" :
                     ^
   drivers/media/i2c/tda1997x.c:1984:46: note: Assuming field 'conv' is null
           v4l2_info(sd, "Color space conversion: %s", state->conv ?
                                                       ^
   include/media/v4l2-common.h:67:39: note: expanded from macro 'v4l2_info'
           v4l2_printk(KERN_INFO, dev, fmt , ## arg)
                                                ^~~
   include/media/v4l2-common.h:58:44: note: expanded from macro 'v4l2_printk'
           printk(level "%s: " fmt, (dev)->name , ## arg)
                                                     ^~~
   drivers/media/i2c/tda1997x.c:1984:46: note: '?' condition is false
           v4l2_info(sd, "Color space conversion: %s", state->conv ?
                                                       ^
   drivers/media/i2c/tda1997x.c:1988:6: note: Assuming field 'audio_channels' is 0
           if (state->audio_channels) {
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/tda1997x.c:1988:2: note: Taking false branch
           if (state->audio_channels) {
           ^
   drivers/media/i2c/tda1997x.c:1996:2: note: Calling 'tda1997x_log_infoframe'
           tda1997x_log_infoframe(sd, AUD_IF);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/tda1997x.c:1933:8: note: Calling 'io_readn'
           len = io_readn(sd, addr, sizeof(buffer), buffer);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/tda1997x.c:425:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < len; i++) {
           ^
   drivers/media/i2c/tda1997x.c:427:7: note: 'val' is < 0
                   if (val < 0)
                       ^~~
   drivers/media/i2c/tda1997x.c:427:3: note: Taking true branch
                   if (val < 0)
                   ^
   drivers/media/i2c/tda1997x.c:428:4: note:  Execution continues on line 433
                           break;
                           ^
   drivers/media/i2c/tda1997x.c:433:2: note: Returning without writing to '*data'
           return sz;
           ^
   drivers/media/i2c/tda1997x.c:1933:8: note: Returning from 'io_readn'
           len = io_readn(sd, addr, sizeof(buffer), buffer);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/tda1997x.c:1934:14: note: Assuming 'debug' is < 1
           v4l2_dbg(1, debug, sd, "infoframe: addr=%d len=%d\n", addr, len);
                       ^
   include/media/v4l2-common.h:73:7: note: expanded from macro 'v4l2_dbg'
                   if (debug >= (level))                                   \
                       ^~~~~~~~~~~~~~~~
   drivers/media/i2c/tda1997x.c:1934:2: note: Taking false branch
           v4l2_dbg(1, debug, sd, "infoframe: addr=%d len=%d\n", addr, len);
           ^
   include/media/v4l2-common.h:73:3: note: expanded from macro 'v4l2_dbg'
                   if (debug >= (level))                                   \
                   ^
   drivers/media/i2c/tda1997x.c:1934:2: note: Loop condition is false.  Exiting loop
           v4l2_dbg(1, debug, sd, "infoframe: addr=%d len=%d\n", addr, len);
           ^
   include/media/v4l2-common.h:72:2: note: expanded from macro 'v4l2_dbg'
           do {                                                            \
           ^
   drivers/media/i2c/tda1997x.c:1936:6: note: Assuming 'err' is not equal to 0
           if (err) {
               ^~~
   drivers/media/i2c/tda1997x.c:1936:2: note: Taking true branch
           if (err) {
           ^
   drivers/media/i2c/tda1997x.c:1937:3: note: 7th function call argument is an uninitialized value
                   v4l_err(state->client,
                   ^
   include/media/v4l2-common.h:31:2: note: expanded from macro 'v4l_err'
           v4l_client_printk(KERN_ERR, client, fmt , ## arg)
           ^                                            ~~~
   include/media/v4l2-common.h:27:2: note: expanded from macro 'v4l_client_printk'
           v4l_printk(level, (client)->dev.driver->name, (client)->adapter, \
           ^
   include/media/v4l2-common.h:24:2: note: expanded from macro 'v4l_printk'
           printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg)
           ^                                                                         ~~~
   drivers/media/i2c/tda1997x.c:2106:2: warning: Value stored to 'reg' is never read [clang-analyzer-deadcode.DeadStores]
           reg = io_read(sd, REG_VERSION);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/tda1997x.c:2106:2: note: Value stored to 'reg' is never read
           reg = io_read(sd, REG_VERSION);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/tda1997x.c:2108:2: warning: Value stored to 'reg' is never read [clang-analyzer-deadcode.DeadStores]
           reg = io_read(sd, REG_CMTP_REG10);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/tda1997x.c:2108:2: note: Value stored to 'reg' is never read
           reg = io_read(sd, REG_CMTP_REG10);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   6 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, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27451 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-19  3:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19  3:49 [tip:locking/core 20/23] include/linux/atomic/atomic-long.h:523:9: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.