All of lore.kernel.org
 help / color / mirror / Atom feed
* [krzk-mem-ctrl:for-v5.16/renesas-rpc 3/3] drivers/memory/renesas-rpc-if.c:556:13: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-10-02  8:07 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-10-02  8:07 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Andrew Gabbasov <andrew_gabbasov@mentor.com>
CC: Krzysztof Kozlowski <krzk@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl.git for-v5.16/renesas-rpc
head:   1869023e24c0de73a160a424dac4621cefd628ae
commit: 1869023e24c0de73a160a424dac4621cefd628ae [3/3] memory: renesas-rpc-if: Avoid unaligned bus access for HyperFlash
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: mips-randconfig-c004-20211001 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 962e503cc8bc411f7523cc393acae8aae425b1c4)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl.git/commit/?id=1869023e24c0de73a160a424dac4621cefd628ae
        git remote add krzk-mem-ctrl https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl.git
        git fetch --no-tags krzk-mem-ctrl for-v5.16/renesas-rpc
        git checkout 1869023e24c0de73a160a424dac4621cefd628ae
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                                   ^
   drivers/staging/rtl8712/rtl8712_efuse.c:548:7: note: Assuming 'word_en' is not equal to 15
                   if (word_en != 0xF)
                       ^~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:548:3: note: Taking true branch
                   if (word_en != 0xF)
                   ^
   drivers/staging/rtl8712/rtl8712_efuse.c:549:9: note: Calling 'r8712_efuse_pg_packet_write'
                           if (!r8712_efuse_pg_packet_write(adapter, offset,
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:367:6: note: Assuming 'efuse_data' is equal to 3
           if (efuse_data != 0x03)
               ^~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:367:2: note: Taking false branch
           if (efuse_data != 0x03)
           ^
   drivers/staging/rtl8712/rtl8712_efuse.c:373:9: note: Assuming 'efuse_addr' is < 'efuse_available_max_size'
           while (efuse_addr < efuse_available_max_size) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:373:2: note: Loop condition is true.  Entering loop body
           while (efuse_addr < efuse_available_max_size) {
           ^
   drivers/staging/rtl8712/rtl8712_efuse.c:375:7: note: Assuming the condition is false
                   if ((curr_size + 1 + target_word_cnts * 2) >
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:375:3: note: Taking false branch
                   if ((curr_size + 1 + target_word_cnts * 2) >
                   ^
   drivers/staging/rtl8712/rtl8712_efuse.c:382:10: note: Assuming the condition is false
                   while (!efuse_one_byte_read(adapter, efuse_addr,
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:382:3: note: Loop condition is false. Execution continues on line 389
                   while (!efuse_one_byte_read(adapter, efuse_addr,
                   ^
   drivers/staging/rtl8712/rtl8712_efuse.c:389:8: note: 'sub_repeat' is <= _REPEAT_THRESHOLD_
                   if ((sub_repeat > _REPEAT_THRESHOLD_) ||
                        ^~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:389:7: note: Left side of '||' is false
                   if ((sub_repeat > _REPEAT_THRESHOLD_) ||
                       ^
   drivers/staging/rtl8712/rtl8712_efuse.c:390:8: note: Assuming 'pg_header' is not equal to 'efuse_data'
                       (pg_header == efuse_data)) {
                        ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:389:3: note: Taking false branch
                   if ((sub_repeat > _REPEAT_THRESHOLD_) ||
                   ^
   drivers/staging/rtl8712/rtl8712_efuse.c:411:7: note: Assuming 'efuse_data' is not equal to 255
                   if (efuse_data == 0xFF)
                       ^~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:411:3: note: Taking false branch
                   if (efuse_data == 0xFF)
                   ^
   drivers/staging/rtl8712/rtl8712_efuse.c:414:8: note: Calling 'fix_header'
                   if (!fix_header(adapter, efuse_data, efuse_addr))
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:285:6: note: Assuming 'addr' is <= 'efuse_available_max_size'
           if (addr > efuse_available_max_size)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:285:2: note: Taking false branch
           if (addr > efuse_available_max_size)
           ^
   drivers/staging/rtl8712/rtl8712_efuse.c:289:2: note: Loop condition is false. Execution continues on line 322
           while (addr < header_addr) {
           ^
   drivers/staging/rtl8712/rtl8712_efuse.c:322:6: note: 'addr' is equal to 'header_addr'
           if (addr != header_addr)
               ^~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:322:2: note: Taking false branch
           if (addr != header_addr)
           ^
   drivers/staging/rtl8712/rtl8712_efuse.c:326:7: note: The value 0 is assigned to 'i'
           for (i = 0; i < PGPKG_MAX_WORDS; i++) {
                ^~~~~
   drivers/staging/rtl8712/rtl8712_efuse.c:326:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < PGPKG_MAX_WORDS; i++) {
           ^
   drivers/staging/rtl8712/rtl8712_efuse.c:327:7: note: Assuming the condition is true
                   if (BIT(i) & pkt.word_en) {
                       ^
   include/vdso/bits.h:7:19: note: expanded from macro 'BIT'
   #define BIT(nr)                 (UL(1) << (nr))
                                   ^
   drivers/staging/rtl8712/rtl8712_efuse.c:327:3: note: Taking true branch
                   if (BIT(i) & pkt.word_en) {
                   ^
   drivers/staging/rtl8712/rtl8712_efuse.c:328:4: note: 3rd function call argument is an uninitialized value
                           efuse_one_byte_write(adapter, addr, pkt.data[i * 2]);
                           ^                                   ~~~~~~~~~~~~~~~
   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.
   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/memory/renesas-rpc-if.c:556:13: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   *(u8 *)to = buf[1];
                             ^
   drivers/memory/renesas-rpc-if.c:594:6: note: Assuming 'len' is <= 'size'
           if (len > size)
               ^~~~~~~~~~
   drivers/memory/renesas-rpc-if.c:594:2: note: Taking false branch
           if (len > size)
           ^
   drivers/memory/renesas-rpc-if.c:610:6: note: Assuming field 'bus_size' is equal to 2
           if (rpc->bus_size == 2)
               ^~~~~~~~~~~~~~~~~~
   drivers/memory/renesas-rpc-if.c:610:2: note: Taking true branch
           if (rpc->bus_size == 2)
           ^
   drivers/memory/renesas-rpc-if.c:611:3: note: Calling 'memcpy_fromio_readw'
                   memcpy_fromio_readw(buf, rpc->dirmap + from, len);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/memory/renesas-rpc-if.c:551:19: note: '?' condition is false
           const int maxw = (IS_ENABLED(CONFIG_64BIT)) ? 8 : 4;
                            ^
   drivers/memory/renesas-rpc-if.c:554:6: note: Assuming 'count' is not equal to 0
           if (count && ((unsigned long)from & 1)) {
               ^~~~~
   drivers/memory/renesas-rpc-if.c:554:6: note: Left side of '&&' is true
   drivers/memory/renesas-rpc-if.c:554:16: note: Assuming the condition is true
           if (count && ((unsigned long)from & 1)) {
                         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/memory/renesas-rpc-if.c:554:2: note: Taking true branch
           if (count && ((unsigned long)from & 1)) {
           ^
   drivers/memory/renesas-rpc-if.c:556:13: note: Assigned value is garbage or undefined
                   *(u8 *)to = buf[1];
                             ^ ~~~~~~
   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.
   1 warning generated.
   Suppressed 1 warnings (1 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.
   1 warning generated.
   Suppressed 1 warnings (1 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.
   lib/math/reciprocal_div.c:51:14: warning: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
           mlow = 1ULL << (32 + l);
                       ^  ~~~~~~~~
   lib/math/reciprocal_div.c:47:2: note: Taking true branch
           WARN(l == 32,
           ^
   include/asm-generic/bug.h:131:2: note: expanded from macro 'WARN'
           if (unlikely(__ret_warn_on))                                    \
           ^
   lib/math/reciprocal_div.c:47:2: note: Loop condition is false.  Exiting loop
           WARN(l == 32,
           ^
   include/asm-generic/bug.h:132:3: note: expanded from macro 'WARN'
                   __WARN_printf(TAINT_WARN, format);                      \
                   ^
   include/asm-generic/bug.h:90:3: note: expanded from macro '__WARN_printf'
                   instrumentation_begin();                                \
                   ^
   include/linux/instrumentation.h:57:34: note: expanded from macro 'instrumentation_begin'
   # define instrumentation_begin()        do { } while(0)
                                           ^
   lib/math/reciprocal_div.c:47:2: note: Loop condition is false.  Exiting loop
           WARN(l == 32,
           ^
   include/asm-generic/bug.h:132:3: note: expanded from macro 'WARN'
                   __WARN_printf(TAINT_WARN, format);                      \
                   ^
   include/asm-generic/bug.h:92:3: note: expanded from macro '__WARN_printf'
                   instrumentation_end();                                  \
                   ^
   include/linux/instrumentation.h:58:33: note: expanded from macro 'instrumentation_end'
   # define instrumentation_end()          do { } while(0)
                                           ^
   lib/math/reciprocal_div.c:47:2: note: Loop condition is false.  Exiting loop
           WARN(l == 32,
           ^
   include/asm-generic/bug.h:132:3: note: expanded from macro 'WARN'
                   __WARN_printf(TAINT_WARN, format);                      \
                   ^
   include/asm-generic/bug.h:89:38: note: expanded from macro '__WARN_printf'
   #define __WARN_printf(taint, arg...) do {                               \
                                        ^
   lib/math/reciprocal_div.c:51:14: note: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long long'
           mlow = 1ULL << (32 + l);
                       ^  ~~~~~~~~
   Suppressed 1 warnings (1 in non-user code).

vim +556 drivers/memory/renesas-rpc-if.c

ca7d8b980b67f1 Sergei Shtylyov 2020-06-16  546  
1869023e24c0de Andrew Gabbasov 2021-09-22  547  static void memcpy_fromio_readw(void *to,
1869023e24c0de Andrew Gabbasov 2021-09-22  548  				const void __iomem *from,
1869023e24c0de Andrew Gabbasov 2021-09-22  549  				size_t count)
1869023e24c0de Andrew Gabbasov 2021-09-22  550  {
1869023e24c0de Andrew Gabbasov 2021-09-22  551  	const int maxw = (IS_ENABLED(CONFIG_64BIT)) ? 8 : 4;
1869023e24c0de Andrew Gabbasov 2021-09-22  552  	u8 buf[2];
1869023e24c0de Andrew Gabbasov 2021-09-22  553  
1869023e24c0de Andrew Gabbasov 2021-09-22  554  	if (count && ((unsigned long)from & 1)) {
1869023e24c0de Andrew Gabbasov 2021-09-22  555  		*(u16 *)buf = __raw_readw((void __iomem *)((unsigned long)from & ~1));
1869023e24c0de Andrew Gabbasov 2021-09-22 @556  		*(u8 *)to = buf[1];
1869023e24c0de Andrew Gabbasov 2021-09-22  557  		from++;
1869023e24c0de Andrew Gabbasov 2021-09-22  558  		to++;
1869023e24c0de Andrew Gabbasov 2021-09-22  559  		count--;
1869023e24c0de Andrew Gabbasov 2021-09-22  560  	}
1869023e24c0de Andrew Gabbasov 2021-09-22  561  	while (count >= 2 && !IS_ALIGNED((unsigned long)from, maxw)) {
1869023e24c0de Andrew Gabbasov 2021-09-22  562  		*(u16 *)to = __raw_readw(from);
1869023e24c0de Andrew Gabbasov 2021-09-22  563  		from += 2;
1869023e24c0de Andrew Gabbasov 2021-09-22  564  		to += 2;
1869023e24c0de Andrew Gabbasov 2021-09-22  565  		count -= 2;
1869023e24c0de Andrew Gabbasov 2021-09-22  566  	}
1869023e24c0de Andrew Gabbasov 2021-09-22  567  	while (count >= maxw) {
1869023e24c0de Andrew Gabbasov 2021-09-22  568  #ifdef CONFIG_64BIT
1869023e24c0de Andrew Gabbasov 2021-09-22  569  		*(u64 *)to = __raw_readq(from);
1869023e24c0de Andrew Gabbasov 2021-09-22  570  #else
1869023e24c0de Andrew Gabbasov 2021-09-22  571  		*(u32 *)to = __raw_readl(from);
1869023e24c0de Andrew Gabbasov 2021-09-22  572  #endif
1869023e24c0de Andrew Gabbasov 2021-09-22  573  		from += maxw;
1869023e24c0de Andrew Gabbasov 2021-09-22  574  		to += maxw;
1869023e24c0de Andrew Gabbasov 2021-09-22  575  		count -= maxw;
1869023e24c0de Andrew Gabbasov 2021-09-22  576  	}
1869023e24c0de Andrew Gabbasov 2021-09-22  577  	while (count >= 2) {
1869023e24c0de Andrew Gabbasov 2021-09-22  578  		*(u16 *)to = __raw_readw(from);
1869023e24c0de Andrew Gabbasov 2021-09-22  579  		from += 2;
1869023e24c0de Andrew Gabbasov 2021-09-22  580  		to += 2;
1869023e24c0de Andrew Gabbasov 2021-09-22  581  		count -= 2;
1869023e24c0de Andrew Gabbasov 2021-09-22  582  	}
1869023e24c0de Andrew Gabbasov 2021-09-22  583  	if (count) {
1869023e24c0de Andrew Gabbasov 2021-09-22  584  		*(u16 *)buf = __raw_readw(from);
1869023e24c0de Andrew Gabbasov 2021-09-22  585  		*(u8 *)to = buf[0];
1869023e24c0de Andrew Gabbasov 2021-09-22  586  	}
1869023e24c0de Andrew Gabbasov 2021-09-22  587  }
1869023e24c0de Andrew Gabbasov 2021-09-22  588  

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

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

only message in thread, other threads:[~2021-10-02  8:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02  8:07 [krzk-mem-ctrl:for-v5.16/renesas-rpc 3/3] drivers/memory/renesas-rpc-if.c:556:13: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] 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.