All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: [linux-next:master 2397/3406] crypto/acompress.c:191:32: warning: Value stored to 'istat' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
Date: Thu, 16 Mar 2023 20:05:26 +0800	[thread overview]
Message-ID: <202303162020.UMXPsl3a-lkp@intel.com> (raw)

:::::: 
:::::: Manual check reason: "low confidence static check warning: crypto/acompress.c:191:32: warning: Value stored to 'istat' during its initialization is never read [clang-analyzer-deadcode.DeadStores]"
:::::: 

BCC: lkp@intel.com
CC: llvm@lists.linux.dev
CC: oe-kbuild-all@lists.linux.dev
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Herbert Xu <herbert@gondor.apana.org.au>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6f72958a49f68553f2b6ff713e8c8e51a34c1e1e
commit: c35f081e4ed448174242d1d37dc4c6525b395942 [2397/3406] crypto: acomp - Count error stats differently
:::::: branch date: 11 hours ago
:::::: commit date: 6 days ago
config: arm-randconfig-c002-20230312 (https://download.01.org/0day-ci/archive/20230316/202303162020.UMXPsl3a-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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/next/linux-next.git/commit/?id=c35f081e4ed448174242d1d37dc4c6525b395942
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout c35f081e4ed448174242d1d37dc4c6525b395942
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer  olddefconfig
        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 <lkp@intel.com>
| Link: https://lore.kernel.org/r/202303162020.UMXPsl3a-lkp@intel.com/

clang_analyzer warnings: (new ones prefixed by >>)
           if (*(ptr++) != ',' ||
           ^
   kernel/debug/gdbstub.c:904:6: note: Assuming the condition is true
           if (remcom_in_buffer[0] == 'Z' && *bpt_type == '0')
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/debug/gdbstub.c:904:6: note: Left side of '&&' is true
   kernel/debug/gdbstub.c:904:36: note: Assuming the condition is false
           if (remcom_in_buffer[0] == 'Z' && *bpt_type == '0')
                                             ^~~~~~~~~~~~~~~~
   kernel/debug/gdbstub.c:904:2: note: Taking false branch
           if (remcom_in_buffer[0] == 'Z' && *bpt_type == '0')
           ^
   kernel/debug/gdbstub.c:906:38: note: Left side of '&&' is false
           else if (remcom_in_buffer[0] == 'z' && *bpt_type == '0')
                                               ^
   kernel/debug/gdbstub.c:908:7: note: Taking true branch
           else if (remcom_in_buffer[0] == 'Z')
                ^
   kernel/debug/gdbstub.c:909:11: note: Called function pointer is null (null dereference)
                   error = arch_kgdb_ops.set_hw_breakpoint(addr,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/debug/gdbstub.c:973:17: warning: Call to function 'strcpy' 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 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   ptr += strlen(strcpy(ptr, "thread:"));
                                 ^
   include/linux/fortify-string.h:231:56: note: expanded from macro 'strlen'
           __builtin_choose_expr(__is_constexpr(__builtin_strlen(p)),      \
                                                                 ^
   include/linux/const.h:12:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
   kernel/debug/gdbstub.c:973:17: note: Call to function 'strcpy' 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 'strlcpy'. CWE-119
                   ptr += strlen(strcpy(ptr, "thread:"));
                                 ^
   include/linux/fortify-string.h:231:56: note: expanded from macro 'strlen'
           __builtin_choose_expr(__is_constexpr(__builtin_strlen(p)),      \
                                                                 ^
   include/linux/const.h:12:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
   kernel/debug/gdbstub.c:981:3: warning: Value stored to 'error' is never read [clang-analyzer-deadcode.DeadStores]
                   error = 0;
                   ^       ~
   kernel/debug/gdbstub.c:981:3: note: Value stored to 'error' is never read
                   error = 0;
                   ^       ~
   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.
   4 warnings generated.
   Suppressed 4 warnings (3 in non-user code, 1 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.
   19 warnings generated.
   arch/arm/kernel/devtree.c:230:6: warning: Access to field 'dt_fixup' results in a dereference of a null pointer (loaded from variable 'mdesc') [clang-analyzer-core.NullDereference]
           if (mdesc->dt_fixup)
               ^~~~~
   arch/arm/kernel/devtree.c:204:6: note: Assuming 'dt_virt' is non-null
           if (!dt_virt || !early_init_dt_verify(dt_virt))
               ^~~~~~~~
   arch/arm/kernel/devtree.c:204:6: note: Left side of '||' is false
   arch/arm/kernel/devtree.c:204:18: note: Assuming the condition is false
           if (!dt_virt || !early_init_dt_verify(dt_virt))
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/kernel/devtree.c:204:2: note: Taking false branch
           if (!dt_virt || !early_init_dt_verify(dt_virt))
           ^
   arch/arm/kernel/devtree.c:207:2: note: Value assigned to 'mdesc'
           mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/kernel/devtree.c:209:6: note: Assuming 'mdesc' is null
           if (!mdesc) {
               ^~~~~~
   arch/arm/kernel/devtree.c:209:2: note: Taking true branch
           if (!mdesc) {
           ^
   arch/arm/kernel/devtree.c:219:10: note: Assuming 'size' is <= 0
                   while (size > 0) {
                          ^~~~~~~~
   arch/arm/kernel/devtree.c:219:3: note: Loop condition is false. Execution continues on line 224
                   while (size > 0) {
                   ^
   arch/arm/kernel/devtree.c:230:6: note: Access to field 'dt_fixup' results in a dereference of a null pointer (loaded from variable 'mdesc')
           if (mdesc->dt_fixup)
               ^~~~~
   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.
   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.
   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.
   19 warnings generated.
   drivers/rapidio/rio-scan.c:565:10: warning: Although the value stored to 'tmp' is used in the enclosing expression, the value is never actually read from 'tmp' [clang-analyzer-deadcode.DeadStores]
           while ((tmp = rio_get_host_deviceid_lock(port, hopcount))
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/rapidio/rio-scan.c:565:10: note: Although the value stored to 'tmp' is used in the enclosing expression, the value is never actually read from 'tmp'
           while ((tmp = rio_get_host_deviceid_lock(port, hopcount))
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   20 warnings generated.
>> crypto/acompress.c:191:32: warning: Value stored to 'istat' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct crypto_istat_compress *istat = comp_get_stat(alg);
                                         ^~~~~   ~~~~~~~~~~~~~~~~~~
   crypto/acompress.c:191:32: note: Value stored to 'istat' during its initialization is never read
           struct crypto_istat_compress *istat = comp_get_stat(alg);
                                         ^~~~~   ~~~~~~~~~~~~~~~~~~
   Suppressed 19 warnings (18 in non-user code, 1 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.
   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.
   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.
   22 warnings generated.
   crypto/testmgr.c:297:8: warning: Excessive padding in 'struct testvec_config' (5 padding bytes, where 1 is optimal). Optimal fields order: name, inplace_mode, req_flags, iv_offset, key_offset, finalization_type, src_divs, dst_divs, iv_offset_relative_to_alignmask, key_offset_relative_to_alignmask, nosimd, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct testvec_config {
   ~~~~~~~^~~~~~~~~~~~~~~~
   crypto/testmgr.c:297:8: note: Excessive padding in 'struct testvec_config' (5 padding bytes, where 1 is optimal). Optimal fields order: name, inplace_mode, req_flags, iv_offset, key_offset, finalization_type, src_divs, dst_divs, iv_offset_relative_to_alignmask, key_offset_relative_to_alignmask, nosimd, consider reordering the fields or adding explicit padding members
   struct testvec_config {
   ~~~~~~~^~~~~~~~~~~~~~~~
   crypto/testmgr.c:625:25: warning: Access to field 'offset' results in a dereference of an undefined pointer value (loaded from field 'div') [clang-analyzer-core.NullDereference]
                   unsigned int offset = partitions[i].div->offset;
                                         ^
   crypto/testmgr.c:2756:19: note: Assuming 'enc' is 0
           const char *op = enc ? "encryption" : "decryption";
                            ^~~
   crypto/testmgr.c:2756:19: note: '?' condition is false
   crypto/testmgr.c:2761:5: note: Assuming field 'iv_offset_relative_to_alignmask' is false
                    (cfg->iv_offset_relative_to_alignmask ? alignmask : 0);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/testmgr.c:2761:5: note: '?' condition is false
   crypto/testmgr.c:2766:6: note: Assuming field 'wk' is 0
           if (vec->wk)
               ^~~~~~~
   crypto/testmgr.c:2766:2: note: Taking false branch
           if (vec->wk)
           ^
   crypto/testmgr.c:2771:8: note: 'err' is equal to 0
           err = do_setkey(crypto_skcipher_setkey, tfm, vec->key, vec->klen,
                 ^
   crypto/testmgr.c:854:6: note: expanded from macro 'do_setkey'
           if (err == 0) {                                                 \
               ^~~
   crypto/testmgr.c:2771:8: note: Taking true branch
           err = do_setkey(crypto_skcipher_setkey, tfm, vec->key, vec->klen,
                 ^
   crypto/testmgr.c:854:2: note: expanded from macro 'do_setkey'
           if (err == 0) {                                                 \
           ^
   crypto/testmgr.c:2773:6: note: Assuming 'err' is 0
           if (err) {
               ^~~
   crypto/testmgr.c:2773:2: note: Taking false branch
           if (err) {
           ^
   crypto/testmgr.c:2781:6: note: Assuming field 'setkey_error' is 0
           if (vec->setkey_error) {
               ^~~~~~~~~~~~~~~~~
   crypto/testmgr.c:2781:2: note: Taking false branch
           if (vec->setkey_error) {
           ^
   crypto/testmgr.c:2788:6: note: Assuming 'ivsize' is 0
           if (ivsize) {
               ^~~~~~
   crypto/testmgr.c:2788:2: note: Taking false branch
           if (ivsize) {
           ^
   crypto/testmgr.c:2798:7: note: Assuming field 'generates_iv' is false
                   if (vec->generates_iv) {
                       ^~~~~~~~~~~~~~~~~
   crypto/testmgr.c:2798:3: note: Taking false branch
                   if (vec->generates_iv) {
                   ^
   crypto/testmgr.c:2807:19: note: 'enc' is 0
           input.iov_base = enc ? (void *)vec->ptext : (void *)vec->ctext;
                            ^~~
   crypto/testmgr.c:2807:19: note: '?' condition is false
   crypto/testmgr.c:2809:8: note: Calling 'build_cipher_test_sglists'
           err = build_cipher_test_sglists(tsgls, cfg, alignmask,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/testmgr.c:779:5: note: Assuming field 'inplace_mode' is equal to OUT_OF_PLACE
                                   cfg->inplace_mode != OUT_OF_PLACE ?
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/testmgr.c:779:5: note: '?' condition is false
   crypto/testmgr.c:778:8: note: Calling 'build_test_sglist'
           err = build_test_sglist(&tsgls->src, cfg->src_divs, alignmask,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/testmgr.c:596:2: note: Taking false branch
           BUILD_BUG_ON(ARRAY_SIZE(partitions) != ARRAY_SIZE(tsgl->sgl));
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   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:397:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:385:2: note: expanded from macro '_compiletime_assert'

vim +/istat +191 crypto/acompress.c

1ab53a77b772bf Giovanni Cabiddu 2016-10-21  188  
c35f081e4ed448 Herbert Xu       2023-02-16  189  void comp_prepare_alg(struct comp_alg_common *alg)
2ebda74fd6c9d3 Giovanni Cabiddu 2016-10-21  190  {
c35f081e4ed448 Herbert Xu       2023-02-16 @191  	struct crypto_istat_compress *istat = comp_get_stat(alg);
2ebda74fd6c9d3 Giovanni Cabiddu 2016-10-21  192  	struct crypto_alg *base = &alg->base;
2ebda74fd6c9d3 Giovanni Cabiddu 2016-10-21  193  
2ebda74fd6c9d3 Giovanni Cabiddu 2016-10-21  194  	base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK;
c35f081e4ed448 Herbert Xu       2023-02-16  195  
c35f081e4ed448 Herbert Xu       2023-02-16  196  	if (IS_ENABLED(CONFIG_CRYPTO_STATS))
c35f081e4ed448 Herbert Xu       2023-02-16  197  		memset(istat, 0, sizeof(*istat));
c35f081e4ed448 Herbert Xu       2023-02-16  198  }
c35f081e4ed448 Herbert Xu       2023-02-16  199  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

                 reply	other threads:[~2023-03-16 12:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202303162020.UMXPsl3a-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.