All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-09-19 12:19 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-09-19 12:19 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jakub Jelinek <jakub@redhat.com>
CC: "Peter Zijlstra (Intel)" <peterz@infradead.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d4d016caa4b85b9aa98d7ec8c84e928621a614bc
commit: 2f78788b55baa3410b1ec91a576286abe1ad4d6a ilog2: improve ilog2 for constant arguments
date:   9 months ago
:::::: branch date: 15 hours ago
:::::: commit date: 9 months ago
config: riscv-randconfig-c006-20210916 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 8cbbd7e0b2aa21ce7e416cfb63d9965518948c35)
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=2f78788b55baa3410b1ec91a576286abe1ad4d6a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 2f78788b55baa3410b1ec91a576286abe1ad4d6a
        # 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 <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                   ^
   include/asm-generic/bug.h:104:3: note: expanded from macro 'WARN_ON_ONCE'
                   __WARN_FLAGS(BUGFLAG_ONCE |                     \
                   ^
   arch/riscv/include/asm/bug.h:79:29: note: expanded from macro '__WARN_FLAGS'
   #define __WARN_FLAGS(flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags))
                               ^
   arch/riscv/include/asm/bug.h:53:32: note: expanded from macro '__BUG_FLAGS'
   #define __BUG_FLAGS(flags)                                      \
                                                                   ^
   kernel/irq/affinity.c:237:22: note: Division by zero
                                    numvecs * ncpus / remaining_ncpus);
                                                    ^
   include/linux/minmax.h:118:59: note: expanded from macro 'max_t'
   #define max_t(type, x, y)       __careful_cmp((type)(x), (type)(y), >)
                                                                   ^
   include/linux/minmax.h:44:17: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                                 ^
   include/linux/minmax.h:38:25: note: expanded from macro '__cmp_once'
                   typeof(y) unique_y = (y);               \
                                         ^
   Suppressed 11 warnings (4 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.
   17 warnings generated.
   crypto/sm3_generic.c:121:2: warning: Value stored to 'a' is never read [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:2: note: Value stored to 'a' is never read
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:6: warning: Although the value stored to 'b' is used in the enclosing expression, the value is never actually read from 'b' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:6: note: Although the value stored to 'b' is used in the enclosing expression, the value is never actually read from 'b'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:10: warning: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:10: note: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:14: warning: Although the value stored to 'd' is used in the enclosing expression, the value is never actually read from 'd' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:14: note: Although the value stored to 'd' is used in the enclosing expression, the value is never actually read from 'd'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:18: warning: Although the value stored to 'e' is used in the enclosing expression, the value is never actually read from 'e' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:18: note: Although the value stored to 'e' is used in the enclosing expression, the value is never actually read from 'e'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:22: warning: Although the value stored to 'f' is used in the enclosing expression, the value is never actually read from 'f' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:22: note: Although the value stored to 'f' is used in the enclosing expression, the value is never actually read from 'f'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:26: warning: Although the value stored to 'g' is used in the enclosing expression, the value is never actually read from 'g' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:26: note: Although the value stored to 'g' is used in the enclosing expression, the value is never actually read from 'g'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:30: warning: Although the value stored to 'h' is used in the enclosing expression, the value is never actually read from 'h' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:30: note: Although the value stored to 'h' is used in the enclosing expression, the value is never actually read from 'h'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:34: warning: Although the value stored to 'ss1' is used in the enclosing expression, the value is never actually read from 'ss1' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                           ^     ~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:34: note: Although the value stored to 'ss1' is used in the enclosing expression, the value is never actually read from 'ss1'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                           ^     ~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:40: warning: Although the value stored to 'ss2' is used in the enclosing expression, the value is never actually read from 'ss2' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                 ^     ~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:40: note: Although the value stored to 'ss2' is used in the enclosing expression, the value is never actually read from 'ss2'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                 ^     ~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:46: warning: Although the value stored to 'tt1' is used in the enclosing expression, the value is never actually read from 'tt1' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                       ^     ~~~~~~~
   crypto/sm3_generic.c:121:46: note: Although the value stored to 'tt1' is used in the enclosing expression, the value is never actually read from 'tt1'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                       ^     ~~~~~~~
   crypto/sm3_generic.c:121:52: warning: Although the value stored to 'tt2' is used in the enclosing expression, the value is never actually read from 'tt2' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                             ^     ~
   crypto/sm3_generic.c:121:52: note: Although the value stored to 'tt2' is used in the enclosing expression, the value is never actually read from 'tt2'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                             ^     ~
   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.
   13 warnings generated.
>> drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           size >>= page_shift;
                ^
   drivers/pci/endpoint/pci-epc-mem.c:244:6: note: Assuming 'mem' is non-null
           if (!mem) {
               ^~~~
   drivers/pci/endpoint/pci-epc-mem.c:244:2: note: Taking false branch
           if (!mem) {
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is false
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is false
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:254:10: note: Calling 'pci_epc_mem_get_order'
           order = pci_epc_mem_get_order(mem, size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is false
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is false
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Calling '__ilog2_u64'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:163:2: note: expanded from macro 'ilog2'
           __ilog2_u64(n)                  \
           ^~~~~~~~~~~~~~
   include/linux/log2.h:32:2: note: Returning the value -1
           return fls64(n) - 1;
           ^~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Returning from '__ilog2_u64'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:163:2: note: expanded from macro 'ilog2'
           __ilog2_u64(n)                  \
           ^~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:2: note: 'page_shift' initialized to 4294967295
           unsigned int page_shift = ilog2(mem->window.page_size);
           ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:29:7: note: Assigned value is garbage or undefined
           size >>= page_shift;
                ^   ~~~~~~~~~~
   Suppressed 12 warnings (5 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.
   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.
   1 warning generated.
   lib/math/rational.c:82:35: warning: Division by zero [clang-analyzer-core.DivideZero]
                                                 (max_denominator - d0) / d1);
                                                                        ^
   include/linux/minmax.h:51:36: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                                            ^
   include/linux/minmax.h:44:17: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                                 ^
   include/linux/minmax.h:38:25: note: expanded from macro '__cmp_once'
                   typeof(y) unique_y = (y);               \
                                         ^
   lib/math/rational.c:52:7: note: The value 0 is assigned to 'd1'
           n0 = d1 = 0;
                ^~~~~~
   lib/math/rational.c:55:2: note: Loop condition is true.  Entering loop body
           for (;;) {
           ^
   lib/math/rational.c:58:7: note: Assuming 'd' is not equal to 0
                   if (d == 0)
                       ^~~~~~
   lib/math/rational.c:58:3: note: Taking false branch
                   if (d == 0)
                   ^
   lib/math/rational.c:80:8: note: Assuming 'n2' is > 'max_numerator'
                   if ((n2 > max_numerator) || (d2 > max_denominator)) {
                        ^~~~~~~~~~~~~~~~~~
   lib/math/rational.c:80:28: note: Left side of '||' is true
                   if ((n2 > max_numerator) || (d2 > max_denominator)) {
                                            ^
   lib/math/rational.c:82:35: note: Division by zero
                                                 (max_denominator - d0) / d1);
                                                                        ^
   include/linux/minmax.h:51:36: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)

vim +29 drivers/pci/endpoint/pci-epc-mem.c

5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  14  
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  15  /**
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  16   * pci_epc_mem_get_order() - determine the allocation order of a memory size
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  17   * @mem: address space of the endpoint controller
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  18   * @size: the size for which to get the order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  19   *
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  20   * Reimplement get_order() for mem->page_size since the generic get_order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  21   * always gets order with a constant PAGE_SIZE.
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  22   */
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  23  static int pci_epc_mem_get_order(struct pci_epc_mem *mem, size_t size)
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  24  {
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  25  	int order;
d45e3c1a5979ef Lad Prabhakar          2020-05-07  26  	unsigned int page_shift = ilog2(mem->window.page_size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  27  
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  28  	size--;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18 @29  	size >>= page_shift;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  30  #if BITS_PER_LONG == 32
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  31  	order = fls(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  32  #else
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  33  	order = fls64(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  34  #endif
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  35  	return order;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  36  }
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  37  

:::::: The code at line 29 was first introduced by commit
:::::: 52c9285d47459cf241e144c7d8ef15941ba1b181 PCI: endpoint: Add support for configurable page size

:::::: TO: Kishon Vijay Abraham I <kishon@ti.com>
:::::: CC: Bjorn Helgaas <bhelgaas@google.com>

---
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: 34968 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-12-08  6:12 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-12-08  6:12 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jakub Jelinek <jakub@redhat.com>
CC: "Peter Zijlstra (Intel)" <peterz@infradead.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   cd8c917a56f20f48748dd43d9ae3caff51d5b987
commit: 2f78788b55baa3410b1ec91a576286abe1ad4d6a ilog2: improve ilog2 for constant arguments
date:   12 months ago
:::::: branch date: 29 hours ago
:::::: commit date: 12 months ago
config: arm-randconfig-c002-20211126 (https://download.01.org/0day-ci/archive/20211208/202112081440.es8aIITo-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5162b558d8c0b542e752b037e72a69d5fd51eb1e)
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=2f78788b55baa3410b1ec91a576286abe1ad4d6a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 2f78788b55baa3410b1ec91a576286abe1ad4d6a
        # save the config file 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 >>)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/locking/lockdep.c:1982:2: note: The value of 'parent' is assigned to 'first_parent'
           first_parent = parent;
           ^~~~~~~~~~~~~~~~~~~~~
   kernel/locking/lockdep.c:1984:9: note: Assuming pointer value is null
           while (parent) {
                  ^~~~~~
   kernel/locking/lockdep.c:1984:2: note: Loop condition is false. Execution continues on line 1989
           while (parent) {
           ^
   kernel/locking/lockdep.c:1991:10: note: Passing null pointer value via 3rd parameter 'prt'
                                        first_parent);
                                        ^~~~~~~~~~~~
   kernel/locking/lockdep.c:1990:2: note: Calling 'print_circular_lock_scenario'
           print_circular_lock_scenario(check_src, check_tgt,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/locking/lockdep.c:1823:30: note: Access to field 'class' results in a dereference of a null pointer (loaded from variable 'prt')
           struct lock_class *parent = prt->class;
                                       ^~~
   Suppressed 13 warnings (11 in non-user code, 2 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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 (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.
   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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   crypto/sha512_generic.c:148:2: warning: Value stored to 'a' is never read [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:2: note: Value stored to 'a' is never read
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:6: warning: Although the value stored to 'b' is used in the enclosing expression, the value is never actually read from 'b' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:6: note: Although the value stored to 'b' is used in the enclosing expression, the value is never actually read from 'b'
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:10: warning: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:10: note: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c'
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:14: warning: Although the value stored to 'd' is used in the enclosing expression, the value is never actually read from 'd' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:14: note: Although the value stored to 'd' is used in the enclosing expression, the value is never actually read from 'd'
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:18: warning: Although the value stored to 'e' is used in the enclosing expression, the value is never actually read from 'e' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                           ^   ~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:18: note: Although the value stored to 'e' is used in the enclosing expression, the value is never actually read from 'e'
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                           ^   ~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:22: warning: Although the value stored to 'f' is used in the enclosing expression, the value is never actually read from 'f' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                               ^   ~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:22: note: Although the value stored to 'f' is used in the enclosing expression, the value is never actually read from 'f'
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                               ^   ~~~~~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:26: warning: Although the value stored to 'g' is used in the enclosing expression, the value is never actually read from 'g' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                                   ^   ~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:26: note: Although the value stored to 'g' is used in the enclosing expression, the value is never actually read from 'g'
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                                   ^   ~~~~~~~~~~~~~~~
   crypto/sha512_generic.c:148:30: warning: Although the value stored to 'h' is used in the enclosing expression, the value is never actually read from 'h' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                                       ^   ~~~~~~~~~~~
   crypto/sha512_generic.c:148:30: note: Although the value stored to 'h' is used in the enclosing expression, the value is never actually read from 'h'
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                                       ^   ~~~~~~~~~~~
   crypto/sha512_generic.c:148:34: warning: Although the value stored to 't1' is used in the enclosing expression, the value is never actually read from 't1' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                                           ^    ~~~~~~
   crypto/sha512_generic.c:148:34: note: Although the value stored to 't1' is used in the enclosing expression, the value is never actually read from 't1'
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                                           ^    ~~~~~~
   crypto/sha512_generic.c:148:39: warning: Although the value stored to 't2' is used in the enclosing expression, the value is never actually read from 't2' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                                                ^    ~
   crypto/sha512_generic.c:148:39: note: Although the value stored to 't2' is used in the enclosing expression, the value is never actually read from 't2'
           a = b = c = d = e = f = g = h = t1 = t2 = 0;
                                                ^    ~
   Suppressed 8 warnings (8 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.
   8 warnings generated.
>> drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           size >>= page_shift;
                ^
   drivers/pci/endpoint/pci-epc-mem.c:244:7: note: 'mem' is non-null
           if (!mem) {
                ^~~
   drivers/pci/endpoint/pci-epc-mem.c:244:2: note: Taking false branch
           if (!mem) {
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is false
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is true
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:254:10: note: Calling 'pci_epc_mem_get_order'
           order = pci_epc_mem_get_order(mem, size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is false
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is true
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Calling '__ilog2_u32'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   include/linux/log2.h:24:2: note: Returning the value -1
           return fls(n) - 1;
           ^~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Returning from '__ilog2_u32'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:2: note: 'page_shift' initialized to 4294967295
           unsigned int page_shift = ilog2(mem->window.page_size);
           ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:29:7: note: Assigned value is garbage or undefined
           size >>= page_shift;
                ^   ~~~~~~~~~~
   Suppressed 7 warnings (7 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.
   8 warnings generated.
   drivers/pci/endpoint/functions/pci-epf-test.c:758:17: warning: Access to field 'msix_capable' results in a dereference of a null pointer (loaded from variable 'epc_features') [clang-analyzer-core.NullDereference]
           msix_capable = epc_features->msix_capable;
                          ^
   drivers/pci/endpoint/functions/pci-epf-test.c:829:19: note: Assuming 'epc' is non-null
           if (WARN_ON_ONCE(!epc))
                            ^
   include/asm-generic/bug.h:145:27: note: expanded from macro 'WARN_ON_ONCE'
           int __ret_warn_once = !!(condition);                    \
                                    ^~~~~~~~~
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: '__ret_warn_once' is 0
           if (WARN_ON_ONCE(!epc))
               ^
   include/asm-generic/bug.h:147:15: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_once && !__warned)) {           \
                        ^~~~~~~~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: Left side of '&&' is false
           if (WARN_ON_ONCE(!epc))
               ^
   include/asm-generic/bug.h:147:31: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_once && !__warned)) {           \
                                        ^
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: '__ret_warn_once' is 0
           if (WARN_ON_ONCE(!epc))
               ^
   include/asm-generic/bug.h:147:15: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_once && !__warned)) {           \
                        ^~~~~~~~~~~~~~~
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: Left side of '&&' is false
           if (WARN_ON_ONCE(!epc))
--
                       ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1243:3: note: Taking false branch
                   if (!ccb)
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1248:3: note: Loop condition is true.  Entering loop body
                   for (j = 0; j < BNAD_MAX_RXQ_PER_RXP; j++) {
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1250:8: note: Assuming 'rcb' is non-null
                           if (!rcb)
                               ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1250:4: note: Taking false branch
                           if (!rcb)
                           ^
   drivers/net/ethernet/brocade/bna/bnad.c:1253:4: note: Calling 'bnad_rxq_alloc_init'
                           bnad_rxq_alloc_init(bnad, rcb);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:266:10: note: Calling 'get_order'
           order = get_order(rcb->rxq->buffer_size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/getorder.h:31:2: note: Taking false branch
           if (__builtin_constant_p(size)) {
           ^
   include/asm-generic/getorder.h:44:9: note: Calling 'fls'
           return fls(size);
                  ^~~~~~~~~
   include/asm-generic/bitops/fls.h:15:2: note: 'r' initialized to 32
           int r = 32;
           ^~~~~
   include/asm-generic/bitops/fls.h:17:6: note: Assuming 'x' is not equal to 0, which participates in a condition later
           if (!x)
               ^~
   include/asm-generic/bitops/fls.h:17:2: note: Taking false branch
           if (!x)
           ^
   include/asm-generic/bitops/fls.h:19:6: note: Assuming the condition is false
           if (!(x & 0xffff0000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:19:2: note: Taking false branch
           if (!(x & 0xffff0000u)) {
           ^
   include/asm-generic/bitops/fls.h:23:6: note: Assuming the condition is false
           if (!(x & 0xff000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:23:2: note: Taking false branch
           if (!(x & 0xff000000u)) {
           ^
   include/asm-generic/bitops/fls.h:27:6: note: Assuming the condition is false
           if (!(x & 0xf0000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:27:2: note: Taking false branch
           if (!(x & 0xf0000000u)) {
           ^
   include/asm-generic/bitops/fls.h:31:6: note: Assuming the condition is false
           if (!(x & 0xc0000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:31:2: note: Taking false branch
           if (!(x & 0xc0000000u)) {
           ^
   include/asm-generic/bitops/fls.h:35:6: note: Assuming the condition is false
           if (!(x & 0x80000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:35:2: note: Taking false branch
           if (!(x & 0x80000000u)) {
           ^
   include/asm-generic/bitops/fls.h:39:2: note: Returning the value 32 (loaded from 'r')
           return r;
           ^~~~~~~~
   include/asm-generic/getorder.h:44:9: note: Returning from 'fls'
           return fls(size);
                  ^~~~~~~~~
   include/asm-generic/getorder.h:44:2: note: Returning the value 32
           return fls(size);
           ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:266:10: note: Returning from 'get_order'
           order = get_order(rcb->rxq->buffer_size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:266:2: note: The value 32 is assigned to 'order'
           order = get_order(rcb->rxq->buffer_size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:6: note: Assuming the condition is true
           if (bna_is_small_rxq(rcb->id)) {
               ^
   drivers/net/ethernet/brocade/bna/bna.h:23:32: note: expanded from macro 'bna_is_small_rxq'
   #define bna_is_small_rxq(_id) ((_id) & 0x1)
                                  ^~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:2: note: Taking true branch
           if (bna_is_small_rxq(rcb->id)) {
           ^
   drivers/net/ethernet/brocade/bna/bnad.c:286:20: note: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned long'
           BUG_ON((PAGE_SIZE << order) % unmap_q->map_size);
                             ^
   include/asm-generic/bug.h:63:45: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                               ^~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
>> drivers/net/ethernet/brocade/bna/bnad.c:286:30: warning: Division by zero [clang-analyzer-core.DivideZero]
           BUG_ON((PAGE_SIZE << order) % unmap_q->map_size);
                                       ^
   drivers/net/ethernet/brocade/bna/bnad.c:1240:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < BNAD_MAX_RXP_PER_RX; i++) {
           ^
   drivers/net/ethernet/brocade/bna/bnad.c:1243:7: note: Assuming 'ccb' is non-null
                   if (!ccb)
                       ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1243:3: note: Taking false branch
                   if (!ccb)
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1248:3: note: Loop condition is true.  Entering loop body
                   for (j = 0; j < BNAD_MAX_RXQ_PER_RXP; j++) {
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1250:8: note: Assuming 'rcb' is non-null
                           if (!rcb)
                               ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1250:4: note: Taking false branch
                           if (!rcb)
                           ^
   drivers/net/ethernet/brocade/bna/bnad.c:1253:4: note: Calling 'bnad_rxq_alloc_init'
                           bnad_rxq_alloc_init(bnad, rcb);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:6: note: Assuming the condition is false
           if (bna_is_small_rxq(rcb->id)) {
               ^
   drivers/net/ethernet/brocade/bna/bna.h:23:32: note: expanded from macro 'bna_is_small_rxq'
   #define bna_is_small_rxq(_id) ((_id) & 0x1)
                                  ^~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:2: note: Taking false branch
           if (bna_is_small_rxq(rcb->id)) {
           ^
   drivers/net/ethernet/brocade/bna/bnad.c:274:7: note: Assuming field 'multi_buffer' is 0
                   if (rcb->rxq->multi_buffer) {
                       ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:274:3: note: Taking false branch
                   if (rcb->rxq->multi_buffer) {
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:281:6: note: Assuming field 'buffer_size' is > 2048
                                   (rcb->rxq->buffer_size > 2048) ?
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:281:5: note: '?' condition is true
                                   (rcb->rxq->buffer_size > 2048) ?
                                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:280:4: note: The value 0 is assigned to field 'map_size'
                           unmap_q->map_size =
                           ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:286:30: note: Division by zero
           BUG_ON((PAGE_SIZE << order) % unmap_q->map_size);
                                       ^
   include/asm-generic/bug.h:63:45: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                      ~~~~~~~~~^~~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   drivers/net/ethernet/brocade/bna/bnad.c:396:3: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   BNA_SET_DMA_ADDR(dma_addr, &rxent->host_addr);
                   ^
   drivers/net/ethernet/brocade/bna/bna.h:34:23: note: expanded from macro 'BNA_SET_DMA_ADDR'
           (_bna_dma_addr)->lsb = ((struct bna_dma_addr *)&tmp_addr)->lsb; \
                                ^
   drivers/net/ethernet/brocade/bna/bnad.c:1860:3: note: Left side of '&&' is false
                   container_of(napi, struct bnad_rx_ctrl, napi);
                   ^
   include/linux/kernel.h:694:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/net/ethernet/brocade/bna/bnad.c:1860:3: note: Taking false branch
                   container_of(napi, struct bnad_rx_ctrl, napi);
                   ^
   include/linux/kernel.h:694: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:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:295:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1860:3: note: Loop condition is false.  Exiting loop
                   container_of(napi, struct bnad_rx_ctrl, napi);
                   ^
   include/linux/kernel.h:694: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:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)

vim +29 drivers/pci/endpoint/pci-epc-mem.c

5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  14  
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  15  /**
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  16   * pci_epc_mem_get_order() - determine the allocation order of a memory size
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  17   * @mem: address space of the endpoint controller
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  18   * @size: the size for which to get the order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  19   *
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  20   * Reimplement get_order() for mem->page_size since the generic get_order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  21   * always gets order with a constant PAGE_SIZE.
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  22   */
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  23  static int pci_epc_mem_get_order(struct pci_epc_mem *mem, size_t size)
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  24  {
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  25  	int order;
d45e3c1a5979ef Lad Prabhakar          2020-05-07  26  	unsigned int page_shift = ilog2(mem->window.page_size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  27  
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  28  	size--;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18 @29  	size >>= page_shift;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  30  #if BITS_PER_LONG == 32
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  31  	order = fls(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  32  #else
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  33  	order = fls64(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  34  #endif
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  35  	return order;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  36  }
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  37  

:::::: The code at line 29 was first introduced by commit
:::::: 52c9285d47459cf241e144c7d8ef15941ba1b181 PCI: endpoint: Add support for configurable page size

:::::: TO: Kishon Vijay Abraham I <kishon@ti.com>
:::::: CC: Bjorn Helgaas <bhelgaas@google.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-11-30  2:09 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-11-30  2:09 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jakub Jelinek <jakub@redhat.com>
CC: "Peter Zijlstra (Intel)" <peterz@infradead.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d58071a8a76d779eedab38033ae4c821c30295a5
commit: 2f78788b55baa3410b1ec91a576286abe1ad4d6a ilog2: improve ilog2 for constant arguments
date:   12 months ago
:::::: branch date: 28 hours ago
:::::: commit date: 12 months ago
config: arm-randconfig-c002-20211126 (https://download.01.org/0day-ci/archive/20211130/202111301003.E8fLkNN5-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5162b558d8c0b542e752b037e72a69d5fd51eb1e)
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=2f78788b55baa3410b1ec91a576286abe1ad4d6a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 2f78788b55baa3410b1ec91a576286abe1ad4d6a
        # save the config file 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 >>)
                                   ^~~~~~~~~~~~~~~~~
   kernel/time/clocksource.c:505:3: note: Taking true branch
                   if (fallback && cs == old_suspend)
                   ^
   kernel/time/clocksource.c:506:4: note:  Execution continues on line 503
                           continue;
                           ^
   kernel/time/clocksource.c:503:2: note: Dereference of null pointer
           list_for_each_entry(cs, &clocksource_list, list) {
           ^
   include/linux/list.h:630:13: note: expanded from macro 'list_for_each_entry'
                pos = list_next_entry(pos, member))
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:555:2: note: expanded from macro 'list_next_entry'
           list_entry((pos)->member.next, typeof(*(pos)), member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:693:25: note: expanded from macro 'container_of'
           void *__mptr = (void *)(ptr);                                   \
                                  ^~~~~
   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.
   20 warnings generated.
   crypto/sm3_generic.c:121:2: warning: Value stored to 'a' is never read [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:2: note: Value stored to 'a' is never read
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:6: warning: Although the value stored to 'b' is used in the enclosing expression, the value is never actually read from 'b' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:6: note: Although the value stored to 'b' is used in the enclosing expression, the value is never actually read from 'b'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:10: warning: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:10: note: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:14: warning: Although the value stored to 'd' is used in the enclosing expression, the value is never actually read from 'd' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:14: note: Although the value stored to 'd' is used in the enclosing expression, the value is never actually read from 'd'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:18: warning: Although the value stored to 'e' is used in the enclosing expression, the value is never actually read from 'e' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:18: note: Although the value stored to 'e' is used in the enclosing expression, the value is never actually read from 'e'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                           ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:22: warning: Although the value stored to 'f' is used in the enclosing expression, the value is never actually read from 'f' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:22: note: Although the value stored to 'f' is used in the enclosing expression, the value is never actually read from 'f'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:26: warning: Although the value stored to 'g' is used in the enclosing expression, the value is never actually read from 'g' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:26: note: Although the value stored to 'g' is used in the enclosing expression, the value is never actually read from 'g'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:30: warning: Although the value stored to 'h' is used in the enclosing expression, the value is never actually read from 'h' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:30: note: Although the value stored to 'h' is used in the enclosing expression, the value is never actually read from 'h'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:34: warning: Although the value stored to 'ss1' is used in the enclosing expression, the value is never actually read from 'ss1' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                           ^     ~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:34: note: Although the value stored to 'ss1' is used in the enclosing expression, the value is never actually read from 'ss1'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                           ^     ~~~~~~~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:40: warning: Although the value stored to 'ss2' is used in the enclosing expression, the value is never actually read from 'ss2' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                 ^     ~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:40: note: Although the value stored to 'ss2' is used in the enclosing expression, the value is never actually read from 'ss2'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                 ^     ~~~~~~~~~~~~~
   crypto/sm3_generic.c:121:46: warning: Although the value stored to 'tt1' is used in the enclosing expression, the value is never actually read from 'tt1' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                       ^     ~~~~~~~
   crypto/sm3_generic.c:121:46: note: Although the value stored to 'tt1' is used in the enclosing expression, the value is never actually read from 'tt1'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                       ^     ~~~~~~~
   crypto/sm3_generic.c:121:52: warning: Although the value stored to 'tt2' is used in the enclosing expression, the value is never actually read from 'tt2' [clang-analyzer-deadcode.DeadStores]
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                             ^     ~
   crypto/sm3_generic.c:121:52: note: Although the value stored to 'tt2' is used in the enclosing expression, the value is never actually read from 'tt2'
           a = b = c = d = e = f = g = h = ss1 = ss2 = tt1 = tt2 = 0;
                                                             ^     ~
   Suppressed 8 warnings (8 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.
   8 warnings generated.
>> drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           size >>= page_shift;
                ^
   drivers/pci/endpoint/pci-epc-mem.c:244:7: note: 'mem' is non-null
           if (!mem) {
                ^~~
   drivers/pci/endpoint/pci-epc-mem.c:244:2: note: Taking false branch
           if (!mem) {
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is false
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is true
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:254:10: note: Calling 'pci_epc_mem_get_order'
           order = pci_epc_mem_get_order(mem, size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is false
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is true
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Calling '__ilog2_u32'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   include/linux/log2.h:24:2: note: Returning the value -1
           return fls(n) - 1;
           ^~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Returning from '__ilog2_u32'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:2: note: 'page_shift' initialized to 4294967295
           unsigned int page_shift = ilog2(mem->window.page_size);
           ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:29:7: note: Assigned value is garbage or undefined
           size >>= page_shift;
                ^   ~~~~~~~~~~
   Suppressed 7 warnings (7 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.
   8 warnings generated.
   drivers/pci/endpoint/functions/pci-epf-test.c:758:17: warning: Access to field 'msix_capable' results in a dereference of a null pointer (loaded from variable 'epc_features') [clang-analyzer-core.NullDereference]
           msix_capable = epc_features->msix_capable;
                          ^
   drivers/pci/endpoint/functions/pci-epf-test.c:829:19: note: Assuming 'epc' is non-null
           if (WARN_ON_ONCE(!epc))
                            ^
   include/asm-generic/bug.h:145:27: note: expanded from macro 'WARN_ON_ONCE'
           int __ret_warn_once = !!(condition);                    \
                                    ^~~~~~~~~
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: '__ret_warn_once' is 0
           if (WARN_ON_ONCE(!epc))
               ^
   include/asm-generic/bug.h:147:15: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_once && !__warned)) {           \
                        ^~~~~~~~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: Left side of '&&' is false
           if (WARN_ON_ONCE(!epc))
               ^
   include/asm-generic/bug.h:147:31: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_once && !__warned)) {           \
                                        ^
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: '__ret_warn_once' is 0
           if (WARN_ON_ONCE(!epc))
               ^
   include/asm-generic/bug.h:147:15: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_once && !__warned)) {           \
                        ^~~~~~~~~~~~~~~
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: Left side of '&&' is false
           if (WARN_ON_ONCE(!epc))
--
                       ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1243:3: note: Taking false branch
                   if (!ccb)
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1248:3: note: Loop condition is true.  Entering loop body
                   for (j = 0; j < BNAD_MAX_RXQ_PER_RXP; j++) {
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1250:8: note: Assuming 'rcb' is non-null
                           if (!rcb)
                               ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1250:4: note: Taking false branch
                           if (!rcb)
                           ^
   drivers/net/ethernet/brocade/bna/bnad.c:1253:4: note: Calling 'bnad_rxq_alloc_init'
                           bnad_rxq_alloc_init(bnad, rcb);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:266:10: note: Calling 'get_order'
           order = get_order(rcb->rxq->buffer_size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/getorder.h:31:2: note: Taking false branch
           if (__builtin_constant_p(size)) {
           ^
   include/asm-generic/getorder.h:44:9: note: Calling 'fls'
           return fls(size);
                  ^~~~~~~~~
   include/asm-generic/bitops/fls.h:15:2: note: 'r' initialized to 32
           int r = 32;
           ^~~~~
   include/asm-generic/bitops/fls.h:17:6: note: Assuming 'x' is not equal to 0, which participates in a condition later
           if (!x)
               ^~
   include/asm-generic/bitops/fls.h:17:2: note: Taking false branch
           if (!x)
           ^
   include/asm-generic/bitops/fls.h:19:6: note: Assuming the condition is false
           if (!(x & 0xffff0000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:19:2: note: Taking false branch
           if (!(x & 0xffff0000u)) {
           ^
   include/asm-generic/bitops/fls.h:23:6: note: Assuming the condition is false
           if (!(x & 0xff000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:23:2: note: Taking false branch
           if (!(x & 0xff000000u)) {
           ^
   include/asm-generic/bitops/fls.h:27:6: note: Assuming the condition is false
           if (!(x & 0xf0000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:27:2: note: Taking false branch
           if (!(x & 0xf0000000u)) {
           ^
   include/asm-generic/bitops/fls.h:31:6: note: Assuming the condition is false
           if (!(x & 0xc0000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:31:2: note: Taking false branch
           if (!(x & 0xc0000000u)) {
           ^
   include/asm-generic/bitops/fls.h:35:6: note: Assuming the condition is false
           if (!(x & 0x80000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:35:2: note: Taking false branch
           if (!(x & 0x80000000u)) {
           ^
   include/asm-generic/bitops/fls.h:39:2: note: Returning the value 32 (loaded from 'r')
           return r;
           ^~~~~~~~
   include/asm-generic/getorder.h:44:9: note: Returning from 'fls'
           return fls(size);
                  ^~~~~~~~~
   include/asm-generic/getorder.h:44:2: note: Returning the value 32
           return fls(size);
           ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:266:10: note: Returning from 'get_order'
           order = get_order(rcb->rxq->buffer_size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:266:2: note: The value 32 is assigned to 'order'
           order = get_order(rcb->rxq->buffer_size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:6: note: Assuming the condition is true
           if (bna_is_small_rxq(rcb->id)) {
               ^
   drivers/net/ethernet/brocade/bna/bna.h:23:32: note: expanded from macro 'bna_is_small_rxq'
   #define bna_is_small_rxq(_id) ((_id) & 0x1)
                                  ^~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:2: note: Taking true branch
           if (bna_is_small_rxq(rcb->id)) {
           ^
   drivers/net/ethernet/brocade/bna/bnad.c:286:20: note: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned long'
           BUG_ON((PAGE_SIZE << order) % unmap_q->map_size);
                             ^
   include/asm-generic/bug.h:63:45: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                               ^~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
>> drivers/net/ethernet/brocade/bna/bnad.c:286:30: warning: Division by zero [clang-analyzer-core.DivideZero]
           BUG_ON((PAGE_SIZE << order) % unmap_q->map_size);
                                       ^
   drivers/net/ethernet/brocade/bna/bnad.c:1240:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < BNAD_MAX_RXP_PER_RX; i++) {
           ^
   drivers/net/ethernet/brocade/bna/bnad.c:1243:7: note: Assuming 'ccb' is non-null
                   if (!ccb)
                       ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1243:3: note: Taking false branch
                   if (!ccb)
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1248:3: note: Loop condition is true.  Entering loop body
                   for (j = 0; j < BNAD_MAX_RXQ_PER_RXP; j++) {
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1250:8: note: Assuming 'rcb' is non-null
                           if (!rcb)
                               ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1250:4: note: Taking false branch
                           if (!rcb)
                           ^
   drivers/net/ethernet/brocade/bna/bnad.c:1253:4: note: Calling 'bnad_rxq_alloc_init'
                           bnad_rxq_alloc_init(bnad, rcb);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:6: note: Assuming the condition is false
           if (bna_is_small_rxq(rcb->id)) {
               ^
   drivers/net/ethernet/brocade/bna/bna.h:23:32: note: expanded from macro 'bna_is_small_rxq'
   #define bna_is_small_rxq(_id) ((_id) & 0x1)
                                  ^~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:2: note: Taking false branch
           if (bna_is_small_rxq(rcb->id)) {
           ^
   drivers/net/ethernet/brocade/bna/bnad.c:274:7: note: Assuming field 'multi_buffer' is 0
                   if (rcb->rxq->multi_buffer) {
                       ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:274:3: note: Taking false branch
                   if (rcb->rxq->multi_buffer) {
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:281:6: note: Assuming field 'buffer_size' is > 2048
                                   (rcb->rxq->buffer_size > 2048) ?
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:281:5: note: '?' condition is true
                                   (rcb->rxq->buffer_size > 2048) ?
                                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:280:4: note: The value 0 is assigned to field 'map_size'
                           unmap_q->map_size =
                           ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:286:30: note: Division by zero
           BUG_ON((PAGE_SIZE << order) % unmap_q->map_size);
                                       ^
   include/asm-generic/bug.h:63:45: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                      ~~~~~~~~~^~~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   drivers/net/ethernet/brocade/bna/bnad.c:396:3: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   BNA_SET_DMA_ADDR(dma_addr, &rxent->host_addr);
                   ^
   drivers/net/ethernet/brocade/bna/bna.h:34:23: note: expanded from macro 'BNA_SET_DMA_ADDR'
           (_bna_dma_addr)->lsb = ((struct bna_dma_addr *)&tmp_addr)->lsb; \
                                ^
   drivers/net/ethernet/brocade/bna/bnad.c:1860:3: note: Left side of '&&' is false
                   container_of(napi, struct bnad_rx_ctrl, napi);
                   ^
   include/linux/kernel.h:694:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/net/ethernet/brocade/bna/bnad.c:1860:3: note: Taking false branch
                   container_of(napi, struct bnad_rx_ctrl, napi);
                   ^
   include/linux/kernel.h:694: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:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:295:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1860:3: note: Loop condition is false.  Exiting loop
                   container_of(napi, struct bnad_rx_ctrl, napi);
                   ^
   include/linux/kernel.h:694: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:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)

vim +29 drivers/pci/endpoint/pci-epc-mem.c

5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  14  
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  15  /**
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  16   * pci_epc_mem_get_order() - determine the allocation order of a memory size
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  17   * @mem: address space of the endpoint controller
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  18   * @size: the size for which to get the order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  19   *
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  20   * Reimplement get_order() for mem->page_size since the generic get_order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  21   * always gets order with a constant PAGE_SIZE.
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  22   */
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  23  static int pci_epc_mem_get_order(struct pci_epc_mem *mem, size_t size)
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  24  {
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  25  	int order;
d45e3c1a5979ef Lad Prabhakar          2020-05-07  26  	unsigned int page_shift = ilog2(mem->window.page_size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  27  
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  28  	size--;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18 @29  	size >>= page_shift;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  30  #if BITS_PER_LONG == 32
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  31  	order = fls(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  32  #else
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  33  	order = fls64(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  34  #endif
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  35  	return order;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  36  }
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  37  

:::::: The code at line 29 was first introduced by commit
:::::: 52c9285d47459cf241e144c7d8ef15941ba1b181 PCI: endpoint: Add support for configurable page size

:::::: TO: Kishon Vijay Abraham I <kishon@ti.com>
:::::: CC: Bjorn Helgaas <bhelgaas@google.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-11-28  3:46 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-11-28  3:46 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jakub Jelinek <jakub@redhat.com>
CC: "Peter Zijlstra (Intel)" <peterz@infradead.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3498e7f2bb415e447354a3debef6738d9655768c
commit: 2f78788b55baa3410b1ec91a576286abe1ad4d6a ilog2: improve ilog2 for constant arguments
date:   12 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 12 months ago
config: arm-randconfig-c002-20211126 (https://download.01.org/0day-ci/archive/20211128/202111281158.rWWuYjqz-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5162b558d8c0b542e752b037e72a69d5fd51eb1e)
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=2f78788b55baa3410b1ec91a576286abe1ad4d6a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 2f78788b55baa3410b1ec91a576286abe1ad4d6a
        # save the config file 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 >>)
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:293:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/gpu/drm/drm_file.c:593:7: note: 'e' is not equal to NULL
                   if (e == NULL) {
                       ^
   drivers/gpu/drm/drm_file.c:593:3: note: Taking false branch
                   if (e == NULL) {
                   ^
   drivers/gpu/drm/drm_file.c:612:8: note: Assuming the condition is false
                           if (length > count - ret) {
                               ^~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_file.c:612:4: note: Taking false branch
                           if (length > count - ret) {
                           ^
   drivers/gpu/drm/drm_file.c:623:8: note: Assuming the condition is false
                           if (copy_to_user(buffer + ret, e->event, length)) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_file.c:623:4: note: Taking false branch
                           if (copy_to_user(buffer + ret, e->event, length)) {
                           ^
   drivers/gpu/drm/drm_file.c:630:4: note: Memory is released
                           kfree(e);
                           ^~~~~~~~
   drivers/gpu/drm/drm_file.c:581:2: note: Loop condition is true.  Entering loop body
           for (;;) {
           ^
   drivers/gpu/drm/drm_file.c:585:7: note: Assuming the condition is true
                   if (!list_empty(&file_priv->event_list)) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_file.c:585:3: note: Taking true branch
                   if (!list_empty(&file_priv->event_list)) {
                   ^
   drivers/gpu/drm/drm_file.c:586:8: note: Left side of '&&' is false
                           e = list_first_entry(&file_priv->event_list,
                               ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:694:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/gpu/drm/drm_file.c:586:8: note: Taking false branch
                           e = list_first_entry(&file_priv->event_list,
                               ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:694:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:295:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/gpu/drm/drm_file.c:586:8: note: Loop condition is false.  Exiting loop
                           e = list_first_entry(&file_priv->event_list,
                               ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:694:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:293:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/gpu/drm/drm_file.c:588:30: note: Use of memory after it is freed
                           file_priv->event_space += e->event->length;
                                                     ^~~~~~~~
   Suppressed 7 warnings (7 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.
   8 warnings generated.
>> drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           size >>= page_shift;
                ^
   drivers/pci/endpoint/pci-epc-mem.c:244:7: note: 'mem' is non-null
           if (!mem) {
                ^~~
   drivers/pci/endpoint/pci-epc-mem.c:244:2: note: Taking false branch
           if (!mem) {
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is false
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is true
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:254:10: note: Calling 'pci_epc_mem_get_order'
           order = pci_epc_mem_get_order(mem, size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is false
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is true
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Calling '__ilog2_u32'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   include/linux/log2.h:24:2: note: Returning the value -1
           return fls(n) - 1;
           ^~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Returning from '__ilog2_u32'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:2: note: 'page_shift' initialized to 4294967295
           unsigned int page_shift = ilog2(mem->window.page_size);
           ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:29:7: note: Assigned value is garbage or undefined
           size >>= page_shift;
                ^   ~~~~~~~~~~
   Suppressed 7 warnings (7 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.
   8 warnings generated.
   drivers/pci/endpoint/functions/pci-epf-test.c:758:17: warning: Access to field 'msix_capable' results in a dereference of a null pointer (loaded from variable 'epc_features') [clang-analyzer-core.NullDereference]
           msix_capable = epc_features->msix_capable;
                          ^
   drivers/pci/endpoint/functions/pci-epf-test.c:829:19: note: Assuming 'epc' is non-null
           if (WARN_ON_ONCE(!epc))
                            ^
   include/asm-generic/bug.h:145:27: note: expanded from macro 'WARN_ON_ONCE'
           int __ret_warn_once = !!(condition);                    \
                                    ^~~~~~~~~
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: '__ret_warn_once' is 0
           if (WARN_ON_ONCE(!epc))
               ^
   include/asm-generic/bug.h:147:15: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_once && !__warned)) {           \
                        ^~~~~~~~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: Left side of '&&' is false
           if (WARN_ON_ONCE(!epc))
               ^
   include/asm-generic/bug.h:147:31: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_once && !__warned)) {           \
                                        ^
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: '__ret_warn_once' is 0
           if (WARN_ON_ONCE(!epc))
               ^
   include/asm-generic/bug.h:147:15: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_once && !__warned)) {           \
                        ^~~~~~~~~~~~~~~
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   drivers/pci/endpoint/functions/pci-epf-test.c:829:6: note: Left side of '&&' is false
           if (WARN_ON_ONCE(!epc))
--
                       ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1243:3: note: Taking false branch
                   if (!ccb)
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1248:3: note: Loop condition is true.  Entering loop body
                   for (j = 0; j < BNAD_MAX_RXQ_PER_RXP; j++) {
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1250:8: note: Assuming 'rcb' is non-null
                           if (!rcb)
                               ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1250:4: note: Taking false branch
                           if (!rcb)
                           ^
   drivers/net/ethernet/brocade/bna/bnad.c:1253:4: note: Calling 'bnad_rxq_alloc_init'
                           bnad_rxq_alloc_init(bnad, rcb);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:266:10: note: Calling 'get_order'
           order = get_order(rcb->rxq->buffer_size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/getorder.h:31:2: note: Taking false branch
           if (__builtin_constant_p(size)) {
           ^
   include/asm-generic/getorder.h:44:9: note: Calling 'fls'
           return fls(size);
                  ^~~~~~~~~
   include/asm-generic/bitops/fls.h:15:2: note: 'r' initialized to 32
           int r = 32;
           ^~~~~
   include/asm-generic/bitops/fls.h:17:6: note: Assuming 'x' is not equal to 0, which participates in a condition later
           if (!x)
               ^~
   include/asm-generic/bitops/fls.h:17:2: note: Taking false branch
           if (!x)
           ^
   include/asm-generic/bitops/fls.h:19:6: note: Assuming the condition is false
           if (!(x & 0xffff0000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:19:2: note: Taking false branch
           if (!(x & 0xffff0000u)) {
           ^
   include/asm-generic/bitops/fls.h:23:6: note: Assuming the condition is false
           if (!(x & 0xff000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:23:2: note: Taking false branch
           if (!(x & 0xff000000u)) {
           ^
   include/asm-generic/bitops/fls.h:27:6: note: Assuming the condition is false
           if (!(x & 0xf0000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:27:2: note: Taking false branch
           if (!(x & 0xf0000000u)) {
           ^
   include/asm-generic/bitops/fls.h:31:6: note: Assuming the condition is false
           if (!(x & 0xc0000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:31:2: note: Taking false branch
           if (!(x & 0xc0000000u)) {
           ^
   include/asm-generic/bitops/fls.h:35:6: note: Assuming the condition is false
           if (!(x & 0x80000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:35:2: note: Taking false branch
           if (!(x & 0x80000000u)) {
           ^
   include/asm-generic/bitops/fls.h:39:2: note: Returning the value 32 (loaded from 'r')
           return r;
           ^~~~~~~~
   include/asm-generic/getorder.h:44:9: note: Returning from 'fls'
           return fls(size);
                  ^~~~~~~~~
   include/asm-generic/getorder.h:44:2: note: Returning the value 32
           return fls(size);
           ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:266:10: note: Returning from 'get_order'
           order = get_order(rcb->rxq->buffer_size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:266:2: note: The value 32 is assigned to 'order'
           order = get_order(rcb->rxq->buffer_size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:6: note: Assuming the condition is true
           if (bna_is_small_rxq(rcb->id)) {
               ^
   drivers/net/ethernet/brocade/bna/bna.h:23:32: note: expanded from macro 'bna_is_small_rxq'
   #define bna_is_small_rxq(_id) ((_id) & 0x1)
                                  ^~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:2: note: Taking true branch
           if (bna_is_small_rxq(rcb->id)) {
           ^
   drivers/net/ethernet/brocade/bna/bnad.c:286:20: note: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned long'
           BUG_ON((PAGE_SIZE << order) % unmap_q->map_size);
                             ^
   include/asm-generic/bug.h:63:45: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                               ^~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
>> drivers/net/ethernet/brocade/bna/bnad.c:286:30: warning: Division by zero [clang-analyzer-core.DivideZero]
           BUG_ON((PAGE_SIZE << order) % unmap_q->map_size);
                                       ^
   drivers/net/ethernet/brocade/bna/bnad.c:1240:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < BNAD_MAX_RXP_PER_RX; i++) {
           ^
   drivers/net/ethernet/brocade/bna/bnad.c:1243:7: note: Assuming 'ccb' is non-null
                   if (!ccb)
                       ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1243:3: note: Taking false branch
                   if (!ccb)
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1248:3: note: Loop condition is true.  Entering loop body
                   for (j = 0; j < BNAD_MAX_RXQ_PER_RXP; j++) {
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1250:8: note: Assuming 'rcb' is non-null
                           if (!rcb)
                               ^~~~
   drivers/net/ethernet/brocade/bna/bnad.c:1250:4: note: Taking false branch
                           if (!rcb)
                           ^
   drivers/net/ethernet/brocade/bna/bnad.c:1253:4: note: Calling 'bnad_rxq_alloc_init'
                           bnad_rxq_alloc_init(bnad, rcb);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:6: note: Assuming the condition is false
           if (bna_is_small_rxq(rcb->id)) {
               ^
   drivers/net/ethernet/brocade/bna/bna.h:23:32: note: expanded from macro 'bna_is_small_rxq'
   #define bna_is_small_rxq(_id) ((_id) & 0x1)
                                  ^~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:270:2: note: Taking false branch
           if (bna_is_small_rxq(rcb->id)) {
           ^
   drivers/net/ethernet/brocade/bna/bnad.c:274:7: note: Assuming field 'multi_buffer' is 0
                   if (rcb->rxq->multi_buffer) {
                       ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:274:3: note: Taking false branch
                   if (rcb->rxq->multi_buffer) {
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:281:6: note: Assuming field 'buffer_size' is > 2048
                                   (rcb->rxq->buffer_size > 2048) ?
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:281:5: note: '?' condition is true
                                   (rcb->rxq->buffer_size > 2048) ?
                                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:280:4: note: The value 0 is assigned to field 'map_size'
                           unmap_q->map_size =
                           ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/brocade/bna/bnad.c:286:30: note: Division by zero
           BUG_ON((PAGE_SIZE << order) % unmap_q->map_size);
                                       ^
   include/asm-generic/bug.h:63:45: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                      ~~~~~~~~~^~~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   drivers/net/ethernet/brocade/bna/bnad.c:396:3: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   BNA_SET_DMA_ADDR(dma_addr, &rxent->host_addr);
                   ^
   drivers/net/ethernet/brocade/bna/bna.h:34:23: note: expanded from macro 'BNA_SET_DMA_ADDR'
           (_bna_dma_addr)->lsb = ((struct bna_dma_addr *)&tmp_addr)->lsb; \
                                ^
   drivers/net/ethernet/brocade/bna/bnad.c:1860:3: note: Left side of '&&' is false
                   container_of(napi, struct bnad_rx_ctrl, napi);
                   ^
   include/linux/kernel.h:694:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/net/ethernet/brocade/bna/bnad.c:1860:3: note: Taking false branch
                   container_of(napi, struct bnad_rx_ctrl, napi);
                   ^
   include/linux/kernel.h:694: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:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:295:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/net/ethernet/brocade/bna/bnad.c:1860:3: note: Loop condition is false.  Exiting loop
                   container_of(napi, struct bnad_rx_ctrl, napi);
                   ^
   include/linux/kernel.h:694: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:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)

vim +29 drivers/pci/endpoint/pci-epc-mem.c

5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  14  
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  15  /**
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  16   * pci_epc_mem_get_order() - determine the allocation order of a memory size
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  17   * @mem: address space of the endpoint controller
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  18   * @size: the size for which to get the order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  19   *
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  20   * Reimplement get_order() for mem->page_size since the generic get_order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  21   * always gets order with a constant PAGE_SIZE.
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  22   */
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  23  static int pci_epc_mem_get_order(struct pci_epc_mem *mem, size_t size)
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  24  {
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  25  	int order;
d45e3c1a5979ef Lad Prabhakar          2020-05-07  26  	unsigned int page_shift = ilog2(mem->window.page_size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  27  
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  28  	size--;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18 @29  	size >>= page_shift;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  30  #if BITS_PER_LONG == 32
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  31  	order = fls(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  32  #else
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  33  	order = fls64(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  34  #endif
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  35  	return order;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  36  }
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  37  

:::::: The code at line 29 was first introduced by commit
:::::: 52c9285d47459cf241e144c7d8ef15941ba1b181 PCI: endpoint: Add support for configurable page size

:::::: TO: Kishon Vijay Abraham I <kishon@ti.com>
:::::: CC: Bjorn Helgaas <bhelgaas@google.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-08-23  2:25 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-08-23  2:25 UTC (permalink / raw)
  To: kbuild

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

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jakub Jelinek <jakub@redhat.com>
CC: "Peter Zijlstra (Intel)" <peterz@infradead.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e22ce8eb631bdc47a4a4ea7ecf4e4ba499db4f93
commit: 2f78788b55baa3410b1ec91a576286abe1ad4d6a ilog2: improve ilog2 for constant arguments
date:   8 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 8 months ago
config: arm-randconfig-c002-20210820 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d9c5613e856cf2addfbf892fc4c1ce9ef9feceaa)
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=2f78788b55baa3410b1ec91a576286abe1ad4d6a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 2f78788b55baa3410b1ec91a576286abe1ad4d6a
        # 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 >>)
           ^
   security/keys/keyring.c:1611:6: note: 'ret' is >= 0
           if (ret < 0)
               ^~~
   security/keys/keyring.c:1611:2: note: Taking false branch
           if (ret < 0)
           ^
   security/keys/keyring.c:1613:8: note: Calling '__key_link_begin'
           ret = __key_link_begin(to_keyring, &key->index_key, &to_edit);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   security/keys/keyring.c:1299:2: note: Taking false branch
           kenter("%d,%s,%s,",
           ^
   security/keys/internal.h:34:2: note: expanded from macro 'kenter'
           no_printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__)
           ^
   include/linux/printk.h:139:2: note: expanded from macro 'no_printk'
           if (0)                                          \
           ^
   security/keys/keyring.c:1302:9: note: Assuming field 'desc_len' is not equal to 0
           BUG_ON(index_key->desc_len == 0);
                  ^
   include/asm-generic/bug.h:183:45: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                               ^~~~~~~~~
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   security/keys/keyring.c:1302:2: note: Taking false branch
           BUG_ON(index_key->desc_len == 0);
           ^
   include/asm-generic/bug.h:183:32: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                  ^
   security/keys/keyring.c:1302:2: note: Loop condition is false.  Exiting loop
           BUG_ON(index_key->desc_len == 0);
           ^
   include/asm-generic/bug.h:183:27: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                             ^
   security/keys/keyring.c:1303:2: note: Taking false branch
           BUG_ON(*_edit != NULL);
           ^
   include/asm-generic/bug.h:183:32: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                  ^
   security/keys/keyring.c:1303:2: note: Loop condition is false.  Exiting loop
           BUG_ON(*_edit != NULL);
           ^
   include/asm-generic/bug.h:183:27: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                             ^
   security/keys/keyring.c:1305:2: note: Null pointer value stored to 'to_edit'
           *_edit = NULL;
           ^~~~~~~~~~~~~
   security/keys/keyring.c:1308:6: note: Assuming the condition is false
           if (test_bit(KEY_FLAG_REVOKED, &keyring->flags))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   security/keys/keyring.c:1308:2: note: Taking false branch
           if (test_bit(KEY_FLAG_REVOKED, &keyring->flags))
           ^
   security/keys/keyring.c:1318:2: note: Taking true branch
           if (IS_ERR(edit)) {
           ^
   security/keys/keyring.c:1320:3: note: Control jumps to line 1340
                   goto error;
                   ^
   security/keys/keyring.c:1340:2: note: Taking false branch
           kleave(" = %d", ret);
           ^
   security/keys/internal.h:36:2: note: expanded from macro 'kleave'
           no_printk(KERN_DEBUG "<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
           ^
   include/linux/printk.h:139:2: note: expanded from macro 'no_printk'
           if (0)                                          \
           ^
   security/keys/keyring.c:1613:8: note: Returning from '__key_link_begin'
           ret = __key_link_begin(to_keyring, &key->index_key, &to_edit);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   security/keys/keyring.c:1614:6: note: 'ret' is >= 0
           if (ret < 0)
               ^~~
   security/keys/keyring.c:1614:2: note: Taking false branch
           if (ret < 0)
           ^
   security/keys/keyring.c:1618:6: note: Access to field 'dead_leaf' results in a dereference of a null pointer (loaded from variable 'to_edit')
           if (to_edit->dead_leaf && (flags & KEYCTL_MOVE_EXCL))
               ^~~~~~~
   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.
   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.
   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.
   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.
   3 warnings generated.
>> drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           size >>= page_shift;
                ^
   drivers/pci/endpoint/pci-epc-mem.c:244:7: note: 'mem' is non-null
           if (!mem) {
                ^~~
   drivers/pci/endpoint/pci-epc-mem.c:244:2: note: Taking false branch
           if (!mem) {
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is false
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:250:15: note: '?' condition is true
           page_shift = ilog2(page_size);
                        ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:254:10: note: Calling 'pci_epc_mem_get_order'
           order = pci_epc_mem_get_order(mem, size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is false
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: '?' condition is true
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Calling '__ilog2_u32'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   include/linux/log2.h:24:2: note: Returning the value -1
           return fls(n) - 1;
           ^~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:28: note: Returning from '__ilog2_u32'
           unsigned int page_shift = ilog2(mem->window.page_size);
                                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:26:2: note: 'page_shift' initialized to 4294967295
           unsigned int page_shift = ilog2(mem->window.page_size);
           ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/endpoint/pci-epc-mem.c:29:7: note: Assigned value is garbage or undefined
           size >>= page_shift;
                ^   ~~~~~~~~~~
   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.
   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.
   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.
   5 warnings generated.
   mm/page-writeback.c:1408:14: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                              ^
   mm/page-writeback.c:1885:6: note: Assuming the condition is false
           if (!(bdi->capabilities & BDI_CAP_WRITEBACK))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/page-writeback.c:1885:2: note: Taking false branch
           if (!(bdi->capabilities & BDI_CAP_WRITEBACK))
           ^
   mm/page-writeback.c:1888:2: note: Taking false branch
           if (inode_cgwb_enabled(inode))
           ^
   mm/page-writeback.c:1890:7: note: 'wb' is null
           if (!wb)
                ^~
   mm/page-writeback.c:1890:2: note: Taking true branch
           if (!wb)
           ^
   mm/page-writeback.c:1894:6: note: Assuming field 'dirty_exceeded' is 0
           if (wb->dirty_exceeded)
               ^~~~~~~~~~~~~~~~~~
   mm/page-writeback.c:1894:2: note: Taking false branch
           if (wb->dirty_exceeded)
           ^
   mm/page-writeback.c:1897:2: note: Loop condition is false.  Exiting loop
           preempt_disable();
           ^
   include/linux/preempt.h:171:27: note: expanded from macro 'preempt_disable'
   #define preempt_disable() \
                             ^
   mm/page-writeback.c:1904:7: note: Loop condition is false.  Exiting loop
           p =  this_cpu_ptr(&bdp_ratelimits);
                ^
   include/linux/percpu-defs.h:265:27: note: expanded from macro 'this_cpu_ptr'
   #define this_cpu_ptr(ptr)       raw_cpu_ptr(ptr)

vim +29 drivers/pci/endpoint/pci-epc-mem.c

5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  14  
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  15  /**
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  16   * pci_epc_mem_get_order() - determine the allocation order of a memory size
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  17   * @mem: address space of the endpoint controller
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  18   * @size: the size for which to get the order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  19   *
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  20   * Reimplement get_order() for mem->page_size since the generic get_order
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  21   * always gets order with a constant PAGE_SIZE.
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  22   */
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  23  static int pci_epc_mem_get_order(struct pci_epc_mem *mem, size_t size)
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  24  {
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  25  	int order;
d45e3c1a5979ef Lad Prabhakar          2020-05-07  26  	unsigned int page_shift = ilog2(mem->window.page_size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  27  
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  28  	size--;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18 @29  	size >>= page_shift;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  30  #if BITS_PER_LONG == 32
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  31  	order = fls(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  32  #else
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  33  	order = fls64(size);
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  34  #endif
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  35  	return order;
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  36  }
52c9285d47459c Kishon Vijay Abraham I 2017-08-18  37  

:::::: The code at line 29 was first introduced by commit
:::::: 52c9285d47459cf241e144c7d8ef15941ba1b181 PCI: endpoint: Add support for configurable page size

:::::: TO: Kishon Vijay Abraham I <kishon@ti.com>
:::::: CC: Bjorn Helgaas <bhelgaas@google.com>

---
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: 32061 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-08  6:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-19 12:19 drivers/pci/endpoint/pci-epc-mem.c:29:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-12-08  6:12 kernel test robot
2021-11-30  2:09 kernel test robot
2021-11-28  3:46 kernel test robot
2021-08-23  2:25 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.