CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Nick Desaulniers <[email protected]>
CC: Kees Cook <[email protected]>
CC: Nathan Chancellor <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   5833291ab6de9c3e2374336b51c814e515e8f3a5
commit: d20758951f8f28c0ee1b2a8a6bb8189858083895 riscv: remove Kconfig check 
for GCC version for ARCH_RV64I
date:   9 weeks ago
:::::: branch date: 21 hours ago
:::::: commit date: 9 weeks ago
config: riscv-randconfig-c006-20211031 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
d321548c3ce987f4f21350ba1c81fdb5d4354224)
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=d20758951f8f28c0ee1b2a8a6bb8189858083895
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout d20758951f8f28c0ee1b2a8a6bb8189858083895
        # 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 >>)
           if (!pk) {
                ^~
   crypto/ecc.c:1625:2: note: Taking false branch
           if (!pk) {
           ^
   crypto/ecc.c:1632:8: note: Calling 'ecc_is_pubkey_valid_partial'
           ret = ecc_is_pubkey_valid_partial(curve, pk);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:1549:14: note: Assuming 'pk->ndigits' is equal to 
'curve->g.ndigits'
           if (WARN_ON(pk->ndigits != curve->g.ndigits))
                       ^
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   crypto/ecc.c:1549:6: note: Taking false branch
           if (WARN_ON(pk->ndigits != curve->g.ndigits))
               ^
   include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   crypto/ecc.c:1549:2: note: Taking false branch
           if (WARN_ON(pk->ndigits != curve->g.ndigits))
           ^
   crypto/ecc.c:1553:2: note: Taking false branch
           if (ecc_point_is_zero(pk))
           ^
   crypto/ecc.c:1557:2: note: Taking false branch
           if (vli_cmp(curve->p, pk->x, pk->ndigits) != 1)
           ^
   crypto/ecc.c:1559:2: note: Taking false branch
           if (vli_cmp(curve->p, pk->y, pk->ndigits) != 1)
           ^
   crypto/ecc.c:1563:2: note: Calling 'vli_mod_square_fast'
           vli_mod_square_fast(yy, pk->y, curve); /* y^2 */
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:979:2: note: Calling 'vli_mmod_fast'
           vli_mmod_fast(result, product, curve);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:915:6: note: Assuming the condition is true
           if (strncmp(curve->name, "nist_", 5) != 0) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:915:2: note: Taking true branch
           if (strncmp(curve->name, "nist_", 5) != 0) {
           ^
   crypto/ecc.c:917:7: note: Assuming the condition is false
                   if (curve_prime[ndigits - 1] == -1ull) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:917:3: note: Taking false branch
                   if (curve_prime[ndigits - 1] == -1ull) {
                   ^
   crypto/ecc.c:921:14: note: Assuming the condition is true
                   } else if (curve_prime[ndigits - 1] == 1ull << 63 &&
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:921:14: note: Left side of '&&' is true
   crypto/ecc.c:922:7: note: Assuming the condition is true
                              curve_prime[ndigits - 2] == 0) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:921:10: note: Taking true branch
                   } else if (curve_prime[ndigits - 1] == 1ull << 63 &&
                          ^
   crypto/ecc.c:923:4: note: Calling 'vli_mmod_special2'
                           vli_mmod_special2(result, product, curve_prime,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:574:2: note: Calling 'vli_set'
           vli_set(r, product, ndigits);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:210:14: note: 'i' is >= 'ndigits'
           for (i = 0; i < ndigits; i++)
                       ^
   crypto/ecc.c:210:2: note: Loop condition is false. Execution continues on 
line 210
           for (i = 0; i < ndigits; i++)
           ^
   crypto/ecc.c:212:1: note: Returning without writing to '*dest'
   }
   ^
   crypto/ecc.c:574:2: note: Returning from 'vli_set'
           vli_set(r, product, ndigits);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:579:6: note: Assuming 'carry' is 0
           if (carry)
               ^~~~~
   crypto/ecc.c:579:2: note: Taking false branch
           if (carry)
           ^
   crypto/ecc.c:581:14: note: 'carry' is 0
           for (i = 1; carry || !vli_is_zero(q, ndigits); i++) {
                       ^~~~~
   crypto/ecc.c:581:14: note: Left side of '||' is false
   crypto/ecc.c:581:2: note: Loop condition is false. Execution continues on 
line 597
           for (i = 1; carry || !vli_is_zero(q, ndigits); i++) {
           ^
   crypto/ecc.c:597:9: note: Calling 'vli_is_negative'
           while (vli_is_negative(r, ndigits * 2))
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:150:9: note: Calling 'vli_test_bit'
           return vli_test_bit(vli, ndigits * 64 - 1);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:145:24: note: The left operand of '&' is a garbage value
           return (vli[bit / 64] & ((u64)1 << (bit % 64)));
                   ~~~~~~~~~~~~~ ^
>> crypto/ecc.c:145:24: warning: The left operand of '&' is a garbage value due 
>> to array index out of bounds 
>> [clang-analyzer-core.UndefinedBinaryOperatorResult]
           return (vli[bit / 64] & ((u64)1 << (bit % 64)));
                                 ^
   crypto/ecc.c:1614:6: note: Assuming 'private_key' is non-null
           if (!private_key || !public_key || !curve ||
               ^~~~~~~~~~~~
   crypto/ecc.c:1614:6: note: Left side of '||' is false
   crypto/ecc.c:1614:22: note: Assuming 'public_key' is non-null
           if (!private_key || !public_key || !curve ||
                               ^~~~~~~~~~~
   crypto/ecc.c:1614:6: note: Left side of '||' is false
           if (!private_key || !public_key || !curve ||
               ^
   crypto/ecc.c:1614:38: note: 'curve' is non-null
           if (!private_key || !public_key || !curve ||
                                               ^~~~~
   crypto/ecc.c:1614:6: note: Left side of '||' is false
           if (!private_key || !public_key || !curve ||
               ^
   crypto/ecc.c:1615:6: note: Assuming the condition is false
               ndigits > ARRAY_SIZE(priv) || ndigits > ARRAY_SIZE(rand_z)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:1614:6: note: Left side of '||' is false
           if (!private_key || !public_key || !curve ||
               ^
   crypto/ecc.c:1614:2: note: Taking false branch
           if (!private_key || !public_key || !curve ||
           ^
   crypto/ecc.c:1625:7: note: 'pk' is non-null
           if (!pk) {
                ^~
   crypto/ecc.c:1625:2: note: Taking false branch
           if (!pk) {
           ^
   crypto/ecc.c:1632:8: note: Calling 'ecc_is_pubkey_valid_partial'
           ret = ecc_is_pubkey_valid_partial(curve, pk);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:1549:14: note: Assuming 'pk->ndigits' is equal to 
'curve->g.ndigits'
           if (WARN_ON(pk->ndigits != curve->g.ndigits))
                       ^
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   crypto/ecc.c:1549:6: note: Taking false branch
           if (WARN_ON(pk->ndigits != curve->g.ndigits))
               ^
   include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   crypto/ecc.c:1549:2: note: Taking false branch
           if (WARN_ON(pk->ndigits != curve->g.ndigits))
           ^
   crypto/ecc.c:1553:2: note: Taking false branch
           if (ecc_point_is_zero(pk))
           ^
   crypto/ecc.c:1557:2: note: Taking false branch
           if (vli_cmp(curve->p, pk->x, pk->ndigits) != 1)
           ^
   crypto/ecc.c:1559:2: note: Taking false branch
           if (vli_cmp(curve->p, pk->y, pk->ndigits) != 1)
           ^
   crypto/ecc.c:1566:2: note: Calling 'vli_mod_mult_fast'
           vli_mod_mult_fast(w, curve->a, pk->x, curve); /* a·x */
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:969:2: note: Calling 'vli_mmod_fast'
           vli_mmod_fast(result, product, curve);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:915:6: note: Assuming the condition is true
           if (strncmp(curve->name, "nist_", 5) != 0) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:915:2: note: Taking true branch
           if (strncmp(curve->name, "nist_", 5) != 0) {
           ^
   crypto/ecc.c:917:7: note: Assuming the condition is false
                   if (curve_prime[ndigits - 1] == -1ull) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:917:3: note: Taking false branch
                   if (curve_prime[ndigits - 1] == -1ull) {
                   ^
   crypto/ecc.c:921:14: note: Assuming the condition is true
                   } else if (curve_prime[ndigits - 1] == 1ull << 63 &&
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:921:14: note: Left side of '&&' is true
   crypto/ecc.c:922:7: note: Assuming the condition is true
                              curve_prime[ndigits - 2] == 0) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:921:10: note: Taking true branch
                   } else if (curve_prime[ndigits - 1] == 1ull << 63 &&
                          ^
   crypto/ecc.c:923:4: note: Calling 'vli_mmod_special2'
                           vli_mmod_special2(result, product, curve_prime,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/ecc.c:579:6: note: Assuming 'carry' is 0
           if (carry)
               ^~~~~
   crypto/ecc.c:579:2: note: Taking false branch
           if (carry)
           ^
   crypto/ecc.c:581:14: note: 'carry' is 0
           for (i = 1; carry || !vli_is_zero(q, ndigits); i++) {
                       ^~~~~

vim +145 crypto/ecc.c

3c4b23901a0c76 Salvatore Benedetto 2016-06-22  141  
0193b32f565e14 Meng Yu             2021-03-19  142  /* Returns nonzero if bit 
of vli is set. */
3c4b23901a0c76 Salvatore Benedetto 2016-06-22  143  static u64 
vli_test_bit(const u64 *vli, unsigned int bit)
3c4b23901a0c76 Salvatore Benedetto 2016-06-22  144  {
3c4b23901a0c76 Salvatore Benedetto 2016-06-22 @145      return (vli[bit / 64] & 
((u64)1 << (bit % 64)));
3c4b23901a0c76 Salvatore Benedetto 2016-06-22  146  }
3c4b23901a0c76 Salvatore Benedetto 2016-06-22  147  

:::::: The code at line 145 was first introduced by commit
:::::: 3c4b23901a0c766879dff680cd6bdab47bcdbbd2 crypto: ecdh - Add ECDH 
software support

:::::: TO: Salvatore Benedetto <[email protected]>
:::::: CC: Herbert Xu <[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