[kbuild] arch/riscv/include/asm/spinlock.h:24:2: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]

2022-03-17 Thread kernel test robot
CC: l...@lists.linux.dev
CC: kbuild-...@lists.01.org
BCC: l...@intel.com
CC: linux-ker...@vger.kernel.org
TO: Thomas Gleixner 
CC: Ingo Molnar 
CC: "Peter Zijlstra (Intel)" 

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   551acdc3c3d2b6bc97f11e31dcf960bc36343bfc
commit: 531ae4b06a737ed5539cd75dc6f6b9a28f900bba locking/rtmutex: Split API 
from implementation
date:   7 months ago
:: branch date: 9 hours ago
:: commit date: 7 months ago
config: riscv-randconfig-c006-20220317 
(https://download.01.org/0day-ci/archive/20220318/202203181309.e0l1dzxg-...@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
a6ec1e3d798f8eab43fb3a91028c6ab04e115fcb)
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=531ae4b06a737ed5539cd75dc6f6b9a28f900bba
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 531ae4b06a737ed5539cd75dc6f6b9a28f900bba
# save the config file 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 


clang-analyzer warnings: (new ones prefixed by >>)
^   ~~~
   lib/mpi/mpih-div.c:37:6: note: Assuming 'dividend_size' is not equal to 0
   if (!dividend_size)
   ^~
   lib/mpi/mpih-div.c:37:2: note: Taking false branch
   if (!dividend_size)
   ^
   lib/mpi/mpih-div.c:49:4: note: Left side of '&&' is false
   && (UDIV_TIME - (2 * UMUL_TIME + 6)) * dividend_size 
> UDIV_TIME) {
   ^
   lib/mpi/mpih-div.c:122:3: note: Taking true branch
   if (UDIV_NEEDS_NORMALIZATION) {
   ^
   lib/mpi/mpih-div.c:125:26: note: Calling 'count_leading_zeros'
   normalization_steps = 
count_leading_zeros(divisor_limb);
 
^
   include/linux/count_zeros.h:25:2: note: Taking true branch
   if (sizeof(x) == 4)
   ^
   include/linux/count_zeros.h:26:3: note: Returning the value 32, which 
participates in a condition later
   return BITS_PER_LONG - fls(x);
   ^
   include/linux/count_zeros.h:26:3: note: Returning the value 32
   return BITS_PER_LONG - fls(x);
   ^
   lib/mpi/mpih-div.c:125:26: note: Returning from 'count_leading_zeros'
   normalization_steps = 
count_leading_zeros(divisor_limb);
 
^
   lib/mpi/mpih-div.c:125:4: note: The value 32 is assigned to 
'normalization_steps'
   normalization_steps = 
count_leading_zeros(divisor_limb);
   
^~~
   lib/mpi/mpih-div.c:126:8: note: 'normalization_steps' is 32
   if (normalization_steps) {
   ^~~
   lib/mpi/mpih-div.c:126:4: note: Taking true branch
   if (normalization_steps) {
   ^
   lib/mpi/mpih-div.c:127:18: note: Assigned value is garbage or undefined
   divisor_limb <<= normalization_steps;
^   ~~~
   lib/mpi/mpih-div.c:202:12: warning: Division by zero 
[clang-analyzer-core.DivideZero]
   return 1 / dsize;
  ~~^~~
   lib/mpi/mpih-div.c:194:2: note: Control jumps to 'case 0:'  at line 195
   switch (dsize) {
   ^
   lib/mpi/mpih-div.c:202:12: note: Division by zero
   return 1 / dsize;
  ~~^~~
   lib/mpi/mpih-div.c:475:18: warning: Assigned value is garbage or undefined 
[clang-analyzer-core.uninitialized.Assign]
   divisor_limb <<= normalization_steps;
^   ~~~
   lib/mpi/mpih-div.c:387:6: note: Assuming 'dividend_size' is not equal to 0
   if (!dividend_size)
   ^~
   lib/mpi/mpih-div.c:387:2: note: Taking false branch
   if (!dividend_size)
   ^
   lib/mpi/mpih-div.c:399:4: note: Left side of '&&' is false
   

[kbuild] arch/riscv/include/asm/spinlock.h:24:2: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]

2022-02-01 Thread kernel test robot
CC: l...@lists.linux.dev
CC: kbuild-...@lists.01.org
CC: linux-ker...@vger.kernel.org
TO: Thomas Gleixner 
CC: Ingo Molnar 
CC: "Peter Zijlstra (Intel)" 

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   26291c54e111ff6ba87a164d85d4a4e134b7315c
commit: 531ae4b06a737ed5539cd75dc6f6b9a28f900bba locking/rtmutex: Split API 
from implementation
date:   6 months ago
:: branch date: 2 days ago
:: commit date: 6 months ago
config: riscv-randconfig-c006-20220121 
(https://download.01.org/0day-ci/archive/20220201/202202012114.gf0lurwz-...@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
d4baf3b1322b84816aa623d8e8cb45a49cb68b84)
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=531ae4b06a737ed5539cd75dc6f6b9a28f900bba
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 531ae4b06a737ed5539cd75dc6f6b9a28f900bba
# save the config file 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 


clang-analyzer warnings: (new ones prefixed by >>)
   ^
   fs/ext4/indirect.c:1254:3: note: Taking false branch
   if (n == 1) {
   ^
   fs/ext4/indirect.c:1265:17: note: Calling 'ext4_find_shared'
   partial = p = ext4_find_shared(inode, n, offsets, chain, 
&nr);
 ^~~
   fs/ext4/indirect.c:795:18: note: 'k' is <= 1
   for (k = depth; k > 1 && !offsets[k-1]; k--)
   ^
   fs/ext4/indirect.c:795:24: note: Left side of '&&' is false
   for (k = depth; k > 1 && !offsets[k-1]; k--)
 ^
   fs/ext4/indirect.c:797:12: note: Calling 'ext4_get_branch'
   partial = ext4_get_branch(inode, k, offsets, chain, &err);
 ^~~
   fs/ext4/indirect.c:155:25: note: Left side of '&&' is false
   add_chain(chain, NULL, EXT4_I(inode)->i_data + *offsets);
  ^
   include/trace/events/ext4.h:22:24: note: expanded from macro 'EXT4_I'
   #define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, 
vfs_inode))
  ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
   BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
  ^
   fs/ext4/indirect.c:155:25: note: Taking false branch
   add_chain(chain, NULL, EXT4_I(inode)->i_data + *offsets);
  ^
   include/trace/events/ext4.h:22:24: note: expanded from macro 'EXT4_I'
   #define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, 
vfs_inode))
  ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
   BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
   ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
   ^
   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/ext4/indirect.c:155:25: note: Loop condition is false.  Exiting loop
   add_chain(chain, NULL, EXT4_I(inode)->i_data + *offsets);
  ^
   include/trace/events/ext4.h:22:24: note: expanded from macro 'EXT4_I'
   #define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, 
vfs_inode))
  ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
   BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
   ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
  

[kbuild] arch/riscv/include/asm/spinlock.h:24:2: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]

2022-01-26 Thread kernel test robot
CC: l...@lists.linux.dev
CC: kbuild-...@lists.01.org
CC: linux-ker...@vger.kernel.org
TO: Thomas Gleixner 
CC: Ingo Molnar 
CC: "Peter Zijlstra (Intel)" 

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0280e3c58f92b2fe0e8fbbdf8d386449168de4a8
commit: 531ae4b06a737ed5539cd75dc6f6b9a28f900bba locking/rtmutex: Split API 
from implementation
date:   5 months ago
:: branch date: 34 hours ago
:: commit date: 5 months ago
config: riscv-randconfig-c006-20220121 
(https://download.01.org/0day-ci/archive/20220127/202201271222.3crzpgzj-...@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
d4baf3b1322b84816aa623d8e8cb45a49cb68b84)
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=531ae4b06a737ed5539cd75dc6f6b9a28f900bba
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 531ae4b06a737ed5539cd75dc6f6b9a28f900bba
# save the config file 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 


clang-analyzer warnings: (new ones prefixed by >>)
   ^~
   fs/orangefs/orangefs-debugfs.c:752:5: note: Call to function 'strcat' is 
insecure as it does not provide bounding of the memory buffer. Replace 
unbounded copy functions with analogous functions that support length arguments 
such as 'strlcat'. CWE-119
   strcat(kernel_debug_string, ",");
   ^~
   fs/orangefs/orangefs-debugfs.c:777:5: warning: Call to function 'strcat' is 
insecure as it does not provide bounding of the memory buffer. Replace 
unbounded copy functions with analogous functions that support length arguments 
such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
   strcat(client_debug_string,
   ^~
   fs/orangefs/orangefs-debugfs.c:777:5: note: Call to function 'strcat' is 
insecure as it does not provide bounding of the memory buffer. Replace 
unbounded copy functions with analogous functions that support length arguments 
such as 'strlcat'. CWE-119
   strcat(client_debug_string,
   ^~
   fs/orangefs/orangefs-debugfs.c:779:5: warning: Call to function 'strcat' is 
insecure as it does not provide bounding of the memory buffer. Replace 
unbounded copy functions with analogous functions that support length arguments 
such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
   strcat(client_debug_string, ",");
   ^~
   fs/orangefs/orangefs-debugfs.c:779:5: note: Call to function 'strcat' is 
insecure as it does not provide bounding of the memory buffer. Replace 
unbounded copy functions with analogous functions that support length arguments 
such as 'strlcat'. CWE-119
   strcat(client_debug_string, ",");
   ^~
   Suppressed 14 warnings (7 in non-user code, 7 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   lib/glob.c:48:32: warning: Assigned value is garbage or undefined 
[clang-analyzer-core.uninitialized.Assign]
   char const *back_pat = NULL, *back_str = back_str;
 ^  
   lib/glob.c:48:32: note: Assigned value is garbage or undefined
   char const *back_pat = NULL, *back_str = back_str;
 ^  
   Suppressed 5 warnings (5 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.
   Suppressed 5 warnings (5 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.
   12 warnings generated.
   Suppressed 12 warnings (5 in non-user code, 7 with check filters).
   Use -header-filter=.* to display