All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/mtd/spi-nor/core.c:1512:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
@ 2022-01-27 10:05 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-01-27 10:05 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Chris Down <chris@chrisdown.name>
CC: Petr Mladek <pmladek@suse.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0280e3c58f92b2fe0e8fbbdf8d386449168de4a8
commit: ad7d61f159db73974f1b0352f21afe04b0bbd920 printk: index: Add indexing support to dev_printk
date:   6 months ago
:::::: branch date: 2 days ago
:::::: commit date: 6 months ago
config: arm-randconfig-c002-20220123 (https://download.01.org/0day-ci/archive/20220127/202201271838.7mI26faO-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 7b3d30728816403d1fd73cc5082e9fb761262bce)
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=ad7d61f159db73974f1b0352f21afe04b0bbd920
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout ad7d61f159db73974f1b0352f21afe04b0bbd920
        # 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 >>)
           dev_dbg(dai->dev, "Mute:%d, Direction:%s\n", mute,
           ^
   include/linux/dev_printk.h:162:2: note: expanded from macro 'dev_dbg'
           if (0)                                                          \
           ^
   drivers/staging/greybus/audio_codec.c:577:6: note: Assuming 'params' is non-null
           if (!params) {
               ^~~~~~~
   drivers/staging/greybus/audio_codec.c:577:2: note: Taking false branch
           if (!params) {
           ^
   drivers/staging/greybus/audio_codec.c:583:6: note: Assuming the condition is false
           if (list_empty(&codec->module_list)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/greybus/audio_codec.c:583:2: note: Taking false branch
           if (list_empty(&codec->module_list)) {
           ^
   drivers/staging/greybus/audio_codec.c:595:2: note: Left side of '&&' is false
           list_for_each_entry(module, &codec->module_list, list) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   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:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/staging/greybus/audio_codec.c:595:2: note: Taking false branch
           list_for_each_entry(module, &codec->module_list, list) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   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)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/staging/greybus/audio_codec.c:595:2: note: Loop condition is false.  Exiting loop
           list_for_each_entry(module, &codec->module_list, list) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   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)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/staging/greybus/audio_codec.c:595:2: note: Loop condition is false. Execution continues on line 601
           list_for_each_entry(module, &codec->module_list, list) {
           ^
   include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^
   drivers/staging/greybus/audio_codec.c:601:6: note: Branch condition evaluates to a garbage value
           if (!data) {
               ^~~~~
   drivers/staging/greybus/audio_codec.c:884:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = gb_audio_apbridgea_unregister_cport(data->connection,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/greybus/audio_codec.c:884:2: note: Value stored to 'ret' is never read
           ret = gb_audio_apbridgea_unregister_cport(data->connection,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/greybus/audio_codec.c:905:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = gb_audio_apbridgea_unregister_cport(data->connection,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/greybus/audio_codec.c:905:2: note: Value stored to 'ret' is never read
           ret = gb_audio_apbridgea_unregister_cport(data->connection,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
>> drivers/mtd/spi-nor/core.c:1512:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
           list_for_each_entry_safe(cmd, next, erase_list, list) {
           ^
   include/linux/list.h:716:7: note: expanded from macro 'list_for_each_entry_safe'
                   n = 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:494:25: note: expanded from macro 'container_of'
           void *__mptr = (void *)(ptr);                                   \
                                  ^
   drivers/mtd/spi-nor/core.c:1651:2: note: Taking false branch
           dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr,
           ^
   include/linux/dev_printk.h:162:2: note: expanded from macro 'dev_dbg'
           if (0)                                                          \
           ^
   drivers/mtd/spi-nor/core.c:1654:2: note: Taking true branch
           if (spi_nor_has_uniform_erase(nor)) {
           ^
   drivers/mtd/spi-nor/core.c:1656:7: note: Assuming 'rem' is 0
                   if (rem)
                       ^~~
   drivers/mtd/spi-nor/core.c:1656:3: note: Taking false branch
                   if (rem)
                   ^
   drivers/mtd/spi-nor/core.c:1664:6: note: 'ret' is 0
           if (ret)
               ^~~
   drivers/mtd/spi-nor/core.c:1664:2: note: Taking false branch
           if (ret)
           ^
   drivers/mtd/spi-nor/core.c:1668:6: note: Assuming 'len' is not equal to field 'size'
           if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
               ^~~~~~~~~~~~~~~~
   drivers/mtd/spi-nor/core.c:1668:23: note: Left side of '&&' is false
           if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
                                ^
   drivers/mtd/spi-nor/core.c:1698:9: note: Taking false branch
           } else if (spi_nor_has_uniform_erase(nor)) {
                  ^
   drivers/mtd/spi-nor/core.c:1718:9: note: Calling 'spi_nor_erase_multi_sectors'
                   ret = spi_nor_erase_multi_sectors(nor, addr, len);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/spi-nor/core.c:1605:6: note: 'ret' is 0
           if (ret)
               ^~~
   drivers/mtd/spi-nor/core.c:1605:2: note: Taking false branch
           if (ret)
           ^
   drivers/mtd/spi-nor/core.c:1608:2: note: Left side of '&&' is false
           list_for_each_entry_safe(cmd, next, &erase_list, list) {
           ^
   include/linux/list.h:715:13: note: expanded from macro 'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
                      ^
   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:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/mtd/spi-nor/core.c:1608:2: note: Taking false branch
           list_for_each_entry_safe(cmd, next, &erase_list, list) {
           ^
   include/linux/list.h:715:13: note: expanded from macro 'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
                      ^
   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)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/mtd/spi-nor/core.c:1608:2: note: Loop condition is false.  Exiting loop
           list_for_each_entry_safe(cmd, next, &erase_list, list) {
           ^
   include/linux/list.h:715:13: note: expanded from macro 'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
                      ^
   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'

vim +1512 drivers/mtd/spi-nor/core.c

5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1503  
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1504  /**
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1505   * spi_nor_destroy_erase_cmd_list() - destroy erase command list
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1506   * @erase_list:	list of erase commands
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1507   */
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1508  static void spi_nor_destroy_erase_cmd_list(struct list_head *erase_list)
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1509  {
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1510  	struct spi_nor_erase_command *cmd, *next;
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1511  
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 @1512  	list_for_each_entry_safe(cmd, next, erase_list, list) {
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1513  		list_del(&cmd->list);
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1514  		kfree(cmd);
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1515  	}
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1516  }
5390a8df769ec9b drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1517  

:::::: The code at line 1512 was first introduced by commit
:::::: 5390a8df769ec9ba9c995191bb0867430f602ebb mtd: spi-nor: add support to non-uniform SFDP SPI NOR flash memories

:::::: TO: Tudor Ambarus <tudor.ambarus@microchip.com>
:::::: CC: Boris Brezillon <boris.brezillon@bootlin.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] 2+ messages in thread

* drivers/mtd/spi-nor/core.c:1512:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
@ 2022-05-05  3:25 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-05-05  3:25 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Chris Down <chris@chrisdown.name>
CC: Petr Mladek <pmladek@suse.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   a7391ad3572431a354c927cf8896e86e50d7d0bf
commit: ad7d61f159db73974f1b0352f21afe04b0bbd920 printk: index: Add indexing support to dev_printk
date:   10 months ago
:::::: branch date: 9 hours ago
:::::: commit date: 10 months ago
config: arm-randconfig-c002-20220428 (https://download.01.org/0day-ci/archive/20220505/202205051125.qgDf9RoF-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c59473aacce38cd7dd77eebceaf3c98c5707ab3b)
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=ad7d61f159db73974f1b0352f21afe04b0bbd920
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout ad7d61f159db73974f1b0352f21afe04b0bbd920
        # save the config file
        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 >>)
           tmp = RREG32_SOC15(GC, 0, mmCP_MQD_CONTROL);
                 ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:49:2: note: expanded from macro 'RREG32_SOC15'
           __RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \
           ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:36:26: note: expanded from macro '__RREG32_SOC15_RLC__'
           ((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.funcs->rlcg_rreg) ? \
                                   ^
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:3531:8: note: Assuming the condition is false
           tmp = RREG32_SOC15(GC, 0, mmCP_HQD_PQ_CONTROL);
                 ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:49:2: note: expanded from macro 'RREG32_SOC15'
           __RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:36:4: note: expanded from macro '__RREG32_SOC15_RLC__'
           ((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.funcs->rlcg_rreg) ? \
             ^~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_virt.h:251:2: note: expanded from macro 'amdgpu_sriov_vf'
   ((adev)->virt.caps & AMDGPU_SRIOV_CAPS_IS_VF)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:3531:8: note: Left side of '&&' is false
           tmp = RREG32_SOC15(GC, 0, mmCP_HQD_PQ_CONTROL);
                 ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:49:2: note: expanded from macro 'RREG32_SOC15'
           __RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \
           ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:36:26: note: expanded from macro '__RREG32_SOC15_RLC__'
           ((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.funcs->rlcg_rreg) ? \
                                   ^
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:3533:9: note: '?' condition is false
                               (order_base_2(ring->ring_size / 4) - 1));
                                ^
   include/linux/log2.h:219:2: note: expanded from macro 'order_base_2'
           __builtin_constant_p(n) ? (             \
           ^
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:3532:8: note: The result of the left shift is undefined because the left operand is negative
           tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, QUEUE_SIZE,
                 ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:1210:46: note: expanded from macro 'REG_SET_FIELD'
            (REG_FIELD_MASK(reg, field) & ((field_val) << REG_FIELD_SHIFT(reg, field))))
                                           ~~~~~~~~~~~ ^
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:4126:4: warning: Value stored to 'tmp' is never read [clang-analyzer-deadcode.DeadStores]
                           tmp = RREG32_SOC15(GC, 0, mmGRBM_SOFT_RESET);
                           ^
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:4126:4: note: Value stored to 'tmp' is never read
   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.
   9 warnings generated.
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_link_encoder.c:310:2: warning: Value stored to 'value' is never read [clang-analyzer-deadcode.DeadStores]
           value = REG_READ(DP_DPHY_INTERNAL_CTRL);
           ^
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_link_encoder.c:310:2: note: Value stored to 'value' is never read
   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.
   7 warnings generated.
   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.
   9 warnings generated.
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_clock_source.c:1264:2: warning: Value stored to 'ss_info_cur' is never read [clang-analyzer-deadcode.DeadStores]
           ss_info_cur = ss_info;
           ^             ~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_clock_source.c:1264:2: note: Value stored to 'ss_info_cur' is never read
           ss_info_cur = ss_info;
           ^             ~~~~~~~
   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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   7 warnings generated.
   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.
   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.
   7 warnings generated.
   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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   10 warnings generated.
   Suppressed 10 warnings (8 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.
   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.
   8 warnings generated.
>> drivers/mtd/spi-nor/core.c:1512:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
           list_for_each_entry_safe(cmd, next, erase_list, list) {
           ^
   include/linux/list.h:716:7: note: expanded from macro 'list_for_each_entry_safe'
                   n = 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:494:25: note: expanded from macro 'container_of'
           void *__mptr = (void *)(ptr);                                   \
                                  ^
   drivers/mtd/spi-nor/core.c:1651:2: note: Taking false branch
           dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr,
           ^
   include/linux/dev_printk.h:162:2: note: expanded from macro 'dev_dbg'
           if (0)                                                          \
           ^
   drivers/mtd/spi-nor/core.c:1654:2: note: Taking true branch
           if (spi_nor_has_uniform_erase(nor)) {
           ^
   drivers/mtd/spi-nor/core.c:1656:7: note: Assuming 'rem' is 0
                   if (rem)
                       ^~~
   drivers/mtd/spi-nor/core.c:1656:3: note: Taking false branch
                   if (rem)
                   ^
   drivers/mtd/spi-nor/core.c:1664:6: note: 'ret' is 0
           if (ret)
               ^~~
   drivers/mtd/spi-nor/core.c:1664:2: note: Taking false branch
           if (ret)
           ^
   drivers/mtd/spi-nor/core.c:1668:6: note: Assuming 'len' is not equal to field 'size'
           if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
               ^~~~~~~~~~~~~~~~
   drivers/mtd/spi-nor/core.c:1668:23: note: Left side of '&&' is false
           if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
                                ^
   drivers/mtd/spi-nor/core.c:1698:9: note: Taking false branch
           } else if (spi_nor_has_uniform_erase(nor)) {
                  ^
   drivers/mtd/spi-nor/core.c:1718:9: note: Calling 'spi_nor_erase_multi_sectors'
                   ret = spi_nor_erase_multi_sectors(nor, addr, len);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/spi-nor/core.c:1605:6: note: 'ret' is 0
           if (ret)
               ^~~
   drivers/mtd/spi-nor/core.c:1605:2: note: Taking false branch
           if (ret)
           ^
   drivers/mtd/spi-nor/core.c:1608:2: note: Left side of '&&' is false
           list_for_each_entry_safe(cmd, next, &erase_list, list) {
           ^
   include/linux/list.h:715:13: note: expanded from macro 'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
                      ^
   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:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/mtd/spi-nor/core.c:1608:2: note: Taking false branch
           list_for_each_entry_safe(cmd, next, &erase_list, list) {
           ^
   include/linux/list.h:715:13: note: expanded from macro 'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
                      ^
   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)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/mtd/spi-nor/core.c:1608:2: note: Loop condition is false.  Exiting loop
           list_for_each_entry_safe(cmd, next, &erase_list, list) {
           ^
   include/linux/list.h:715:13: note: expanded from macro 'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
                      ^
   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'

vim +1512 drivers/mtd/spi-nor/core.c

5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1503  
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1504  /**
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1505   * spi_nor_destroy_erase_cmd_list() - destroy erase command list
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1506   * @erase_list:	list of erase commands
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1507   */
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1508  static void spi_nor_destroy_erase_cmd_list(struct list_head *erase_list)
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1509  {
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1510  	struct spi_nor_erase_command *cmd, *next;
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1511  
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 @1512  	list_for_each_entry_safe(cmd, next, erase_list, list) {
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1513  		list_del(&cmd->list);
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1514  		kfree(cmd);
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1515  	}
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1516  }
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11  1517  

:::::: The code at line 1512 was first introduced by commit
:::::: 5390a8df769ec9ba9c995191bb0867430f602ebb mtd: spi-nor: add support to non-uniform SFDP SPI NOR flash memories

:::::: TO: Tudor Ambarus <tudor.ambarus@microchip.com>
:::::: CC: Boris Brezillon <boris.brezillon@bootlin.com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

end of thread, other threads:[~2022-05-05  3:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-27 10:05 drivers/mtd/spi-nor/core.c:1512:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-05-05  3: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.