All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/perf/arm_smmuv3_pmu.c:349:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-03-16 13:44 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-03-16 13:44 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 21466 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: John Garry <john.garry@huawei.com>
CC: Will Deacon <will@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   56e337f2cf1326323844927a04e9dbce9a244835
commit: e656972b69864348a747954ea187576808000c5a drivers/perf: Improve build test coverage
date:   5 months ago
:::::: branch date: 21 hours ago
:::::: commit date: 5 months ago
config: riscv-randconfig-c006-20220313 (https://download.01.org/0day-ci/archive/20220316/202203162129.qyCtDjXt-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 43f668b98e8d87290fc6bbf5ed13c3ab542e3497)
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=e656972b69864348a747954ea187576808000c5a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e656972b69864348a747954ea187576808000c5a
        # save the config file 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 >>)
   fs/xfs/xfs_sysfs.c:633:25: note: Passing value via 1st parameter 'kobj'
           error = xfs_sysfs_init(&mp->m_error_kobj, &xfs_error_ktype,
                                  ^~~~~~~~~~~~~~~~~
   fs/xfs/xfs_sysfs.c:633:10: note: Calling 'xfs_sysfs_init'
           error = xfs_sysfs_init(&mp->m_error_kobj, &xfs_error_ktype,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_sysfs.h:37:11: note: Assuming 'parent_kobj' is null
           parent = parent_kobj ? &parent_kobj->kobject : NULL;
                    ^~~~~~~~~~~
   fs/xfs/xfs_sysfs.h:37:11: note: '?' condition is false
   fs/xfs/xfs_sysfs.h:38:18: note: Passing value via 1st parameter 'x'
           init_completion(&kobj->complete);
                           ^~~~~~~~~~~~~~~
   fs/xfs/xfs_sysfs.h:38:2: note: Calling 'init_completion'
           init_completion(&kobj->complete);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/completion.h:86:10: note: Access to field 'done' results in a dereference of a null pointer (loaded from variable 'x')
           x->done = 0;
           ~       ^
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   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.
   4 warnings generated.
   crypto/pcbc.c:74:10: warning: Although the value stored to 'nbytes' is used in the enclosing expression, the value is never actually read from 'nbytes' [clang-analyzer-deadcode.DeadStores]
           while ((nbytes = walk.nbytes)) {
                   ^        ~~~~~~~~~~~
   crypto/pcbc.c:74:10: note: Although the value stored to 'nbytes' is used in the enclosing expression, the value is never actually read from 'nbytes'
           while ((nbytes = walk.nbytes)) {
                   ^        ~~~~~~~~~~~
   crypto/pcbc.c:141:10: warning: Although the value stored to 'nbytes' is used in the enclosing expression, the value is never actually read from 'nbytes' [clang-analyzer-deadcode.DeadStores]
           while ((nbytes = walk.nbytes)) {
                   ^        ~~~~~~~~~~~
   crypto/pcbc.c:141:10: note: Although the value stored to 'nbytes' is used in the enclosing expression, the value is never actually read from 'nbytes'
           while ((nbytes = walk.nbytes)) {
                   ^        ~~~~~~~~~~~
   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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   fs/xfs/xfs_pnfs.c:39:3: warning: Value stored to 'error' is never read [clang-analyzer-deadcode.DeadStores]
                   error = break_layout(inode, true);
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_pnfs.c:39:3: note: Value stored to 'error' is never read
                   error = break_layout(inode, true);
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
>> drivers/perf/arm_smmuv3_pmu.c:349:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = smmu_pmu->dev;
                          ^~~   ~~~~~~~~~~~~~
   drivers/perf/arm_smmuv3_pmu.c:349:17: note: Value stored to 'dev' during its initialization is never read
           struct device *dev = smmu_pmu->dev;
                          ^~~   ~~~~~~~~~~~~~
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   drivers/hwtracing/intel_th/msu.c:860:2: warning: Value stored to 'reg' is never read [clang-analyzer-deadcode.DeadStores]
           reg = ioread32(msc->reg_base + REG_MSU_MSC0STS);
           ^
   drivers/hwtracing/intel_th/msu.c:860:2: note: Value stored to 'reg' is never read
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   drivers/fpga/altera-pr-ip-core.c:188:2: warning: Value stored to 'val' is never read [clang-analyzer-deadcode.DeadStores]
           val = readl(priv->reg_base + ALT_PR_CSR_OFST);
           ^
   drivers/fpga/altera-pr-ip-core.c:188:2: note: Value stored to 'val' is never read
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   drivers/staging/rts5208/ms.c:1770:3: warning: Value stored to 'retval' is never read [clang-analyzer-deadcode.DeadStores]
                   retval = ms_set_rw_reg_addr(chip, OVERWRITE_FLAG, MS_EXTRA_SIZE,
                   ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/rts5208/ms.c:1770:3: note: Value stored to 'retval' is never read
                   retval = ms_set_rw_reg_addr(chip, OVERWRITE_FLAG, MS_EXTRA_SIZE,
                   ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   11 warnings generated.
   drivers/staging/iio/adc/ad7280a.c:130:8: warning: Excessive padding in 'struct ad7280_state' (110 padding bytes, where 46 is optimal). 
   Optimal fields order: 
   buf, 
   spi, 
   channels, 
   iio_attr, 
   lock, 
   slave_num, 
   scan_cnt, 
   readback_delay_us, 
   ctrl_hb, 
   ctrl_lb, 
   cell_threshhigh, 
   cell_threshlow, 
   aux_threshhigh, 
   aux_threshlow, 
   cb_mask, 
   crc_tab, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct ad7280_state {
   ~~~~~~~^~~~~~~~~~~~~~
   drivers/staging/iio/adc/ad7280a.c:130:8: note: Excessive padding in 'struct ad7280_state' (110 padding bytes, where 46 is optimal). Optimal fields order: buf, spi, channels, iio_attr, lock, slave_num, scan_cnt, readback_delay_us, ctrl_hb, ctrl_lb, cell_threshhigh, cell_threshlow, aux_threshhigh, aux_threshlow, cb_mask, crc_tab, consider reordering the fields or adding explicit padding members
   struct ad7280_state {
   ~~~~~~~^~~~~~~~~~~~~~
   Suppressed 10 warnings (3 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.
   11 warnings generated.
   drivers/staging/iio/addac/adt7316.c:1888:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = chip->bus.write(chip->bus.client, ADT7316_INT_MASK1, mask);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/iio/addac/adt7316.c:1888:2: note: Value stored to 'ret' is never read
           ret = chip->bus.write(chip->bus.client, ADT7316_INT_MASK1, mask);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   12 warnings generated.

vim +/dev +349 drivers/perf/arm_smmuv3_pmu.c

3c9347351a6ea12 Robin Murphy 2019-08-01  339  
7d839b4b9e00645 Neil Leeder  2019-03-26  340  /*
7d839b4b9e00645 Neil Leeder  2019-03-26  341   * Implementation of abstract pmu functionality required by
7d839b4b9e00645 Neil Leeder  2019-03-26  342   * the core perf events code.
7d839b4b9e00645 Neil Leeder  2019-03-26  343   */
7d839b4b9e00645 Neil Leeder  2019-03-26  344  
7d839b4b9e00645 Neil Leeder  2019-03-26  345  static int smmu_pmu_event_init(struct perf_event *event)
7d839b4b9e00645 Neil Leeder  2019-03-26  346  {
7d839b4b9e00645 Neil Leeder  2019-03-26  347  	struct hw_perf_event *hwc = &event->hw;
7d839b4b9e00645 Neil Leeder  2019-03-26  348  	struct smmu_pmu *smmu_pmu = to_smmu_pmu(event->pmu);
7d839b4b9e00645 Neil Leeder  2019-03-26 @349  	struct device *dev = smmu_pmu->dev;
7d839b4b9e00645 Neil Leeder  2019-03-26  350  	struct perf_event *sibling;
33e84ea4330da8a Robin Murphy 2019-08-01  351  	int group_num_events = 1;
7d839b4b9e00645 Neil Leeder  2019-03-26  352  	u16 event_id;
7d839b4b9e00645 Neil Leeder  2019-03-26  353  
7d839b4b9e00645 Neil Leeder  2019-03-26  354  	if (event->attr.type != event->pmu->type)
7d839b4b9e00645 Neil Leeder  2019-03-26  355  		return -ENOENT;
7d839b4b9e00645 Neil Leeder  2019-03-26  356  
7d839b4b9e00645 Neil Leeder  2019-03-26  357  	if (hwc->sample_period) {
7d839b4b9e00645 Neil Leeder  2019-03-26  358  		dev_dbg(dev, "Sampling not supported\n");
7d839b4b9e00645 Neil Leeder  2019-03-26  359  		return -EOPNOTSUPP;
7d839b4b9e00645 Neil Leeder  2019-03-26  360  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  361  
7d839b4b9e00645 Neil Leeder  2019-03-26  362  	if (event->cpu < 0) {
7d839b4b9e00645 Neil Leeder  2019-03-26  363  		dev_dbg(dev, "Per-task mode not supported\n");
7d839b4b9e00645 Neil Leeder  2019-03-26  364  		return -EOPNOTSUPP;
7d839b4b9e00645 Neil Leeder  2019-03-26  365  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  366  
7d839b4b9e00645 Neil Leeder  2019-03-26  367  	/* Verify specified event is supported on this PMU */
7d839b4b9e00645 Neil Leeder  2019-03-26  368  	event_id = get_event(event);
7d839b4b9e00645 Neil Leeder  2019-03-26  369  	if (event_id < SMMU_PMCG_ARCH_MAX_EVENTS &&
7d839b4b9e00645 Neil Leeder  2019-03-26  370  	    (!test_bit(event_id, smmu_pmu->supported_events))) {
7d839b4b9e00645 Neil Leeder  2019-03-26  371  		dev_dbg(dev, "Invalid event %d for this PMU\n", event_id);
7d839b4b9e00645 Neil Leeder  2019-03-26  372  		return -EINVAL;
7d839b4b9e00645 Neil Leeder  2019-03-26  373  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  374  
7d839b4b9e00645 Neil Leeder  2019-03-26  375  	/* Don't allow groups with mixed PMUs, except for s/w events */
33e84ea4330da8a Robin Murphy 2019-08-01  376  	if (!is_software_event(event->group_leader)) {
3c9347351a6ea12 Robin Murphy 2019-08-01  377  		if (!smmu_pmu_events_compatible(event->group_leader, event))
33e84ea4330da8a Robin Murphy 2019-08-01  378  			return -EINVAL;
33e84ea4330da8a Robin Murphy 2019-08-01  379  
33e84ea4330da8a Robin Murphy 2019-08-01  380  		if (++group_num_events > smmu_pmu->num_counters)
7d839b4b9e00645 Neil Leeder  2019-03-26  381  			return -EINVAL;
7d839b4b9e00645 Neil Leeder  2019-03-26  382  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  383  
7d839b4b9e00645 Neil Leeder  2019-03-26  384  	for_each_sibling_event(sibling, event->group_leader) {
33e84ea4330da8a Robin Murphy 2019-08-01  385  		if (is_software_event(sibling))
33e84ea4330da8a Robin Murphy 2019-08-01  386  			continue;
33e84ea4330da8a Robin Murphy 2019-08-01  387  
3c9347351a6ea12 Robin Murphy 2019-08-01  388  		if (!smmu_pmu_events_compatible(sibling, event))
33e84ea4330da8a Robin Murphy 2019-08-01  389  			return -EINVAL;
33e84ea4330da8a Robin Murphy 2019-08-01  390  
33e84ea4330da8a Robin Murphy 2019-08-01  391  		if (++group_num_events > smmu_pmu->num_counters)
7d839b4b9e00645 Neil Leeder  2019-03-26  392  			return -EINVAL;
7d839b4b9e00645 Neil Leeder  2019-03-26  393  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  394  
7d839b4b9e00645 Neil Leeder  2019-03-26  395  	hwc->idx = -1;
7d839b4b9e00645 Neil Leeder  2019-03-26  396  
7d839b4b9e00645 Neil Leeder  2019-03-26  397  	/*
7d839b4b9e00645 Neil Leeder  2019-03-26  398  	 * Ensure all events are on the same cpu so all events are in the
7d839b4b9e00645 Neil Leeder  2019-03-26  399  	 * same cpu context, to avoid races on pmu_enable etc.
7d839b4b9e00645 Neil Leeder  2019-03-26  400  	 */
7d839b4b9e00645 Neil Leeder  2019-03-26  401  	event->cpu = smmu_pmu->on_cpu;
7d839b4b9e00645 Neil Leeder  2019-03-26  402  
7d839b4b9e00645 Neil Leeder  2019-03-26  403  	return 0;
7d839b4b9e00645 Neil Leeder  2019-03-26  404  }
7d839b4b9e00645 Neil Leeder  2019-03-26  405  

:::::: The code at line 349 was first introduced by commit
:::::: 7d839b4b9e00645e49345d6ce5dfa8edf53c1a21 perf/smmuv3: Add arm64 smmuv3 pmu driver

:::::: TO: Neil Leeder <nleeder@codeaurora.org>
:::::: CC: Will Deacon <will.deacon@arm.com>

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

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

* drivers/perf/arm_smmuv3_pmu.c:349:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-03-20 18:14 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-03-20 18:14 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 21321 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: John Garry <john.garry@huawei.com>
CC: Will Deacon <will@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   14702b3b2438e2f2d07ae93b5d695c166e5c83d1
commit: e656972b69864348a747954ea187576808000c5a drivers/perf: Improve build test coverage
date:   6 months ago
:::::: branch date: 19 hours ago
:::::: commit date: 6 months ago
config: riscv-randconfig-c006-20220313 (https://download.01.org/0day-ci/archive/20220321/202203210246.W8OFaWHR-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 43f668b98e8d87290fc6bbf5ed13c3ab542e3497)
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=e656972b69864348a747954ea187576808000c5a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e656972b69864348a747954ea187576808000c5a
        # save the config file 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 >>)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:179:2: note: Taking true branch
           if (value & ~XSCOM_DATA_IND_FORM1_DATA)
           ^
   drivers/fsi/fsi-scom.c:180:3: note: Returning without writing to '*status'
                   return -EINVAL;
                   ^
   drivers/fsi/fsi-scom.c:221:11: note: Returning from 'put_indirect_scom_form1'
                           return put_indirect_scom_form1(scom, value, addr, status);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:221:4: note: Returning without writing to '*status'
                           return put_indirect_scom_form1(scom, value, addr, status);
                           ^
   drivers/fsi/fsi-scom.c:291:7: note: Returning from 'raw_put_scom'
           rc = raw_put_scom(scom, value, addr, &status);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:292:2: note: Taking false branch
           if (rc == -ENODEV)
           ^
   drivers/fsi/fsi-scom.c:295:7: note: 2nd function call argument is an uninitialized value
           rc = handle_fsi2pib_status(scom, status);
                ^                           ~~~~~~
   drivers/fsi/fsi-scom.c:314:7: warning: 2nd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           rc = handle_fsi2pib_status(scom, status);
                ^
   drivers/fsi/fsi-scom.c:331:6: note: Assuming the condition is false
           if (len != sizeof(uint64_t))
               ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:331:2: note: Taking false branch
           if (len != sizeof(uint64_t))
           ^
   drivers/fsi/fsi-scom.c:335:6: note: Assuming field 'dead' is false
           if (scom->dead)
               ^~~~~~~~~~
   drivers/fsi/fsi-scom.c:335:2: note: Taking false branch
           if (scom->dead)
           ^
   drivers/fsi/fsi-scom.c:338:8: note: Calling 'get_scom'
                   rc = get_scom(scom, &val, *offset);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:307:2: note: 'status' declared without an initial value
           uint32_t status;
           ^~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:310:7: note: Calling 'raw_get_scom'
           rc = raw_get_scom(scom, value, addr, &status);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:231:6: note: Assuming the condition is true
           if (addr & XSCOM_ADDR_IND_FLAG) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:231:2: note: Taking true branch
           if (addr & XSCOM_ADDR_IND_FLAG) {
           ^
   drivers/fsi/fsi-scom.c:232:7: note: Assuming the condition is true
                   if (addr & XSCOM_ADDR_INF_FORM1)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:232:3: note: Taking true branch
                   if (addr & XSCOM_ADDR_INF_FORM1)
                   ^
   drivers/fsi/fsi-scom.c:233:4: note: Returning without writing to '*status'
                           return -ENXIO;
                           ^
   drivers/fsi/fsi-scom.c:310:7: note: Returning from 'raw_get_scom'
           rc = raw_get_scom(scom, value, addr, &status);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:311:2: note: Taking false branch
           if (rc == -ENODEV)
           ^
   drivers/fsi/fsi-scom.c:314:7: note: 2nd function call argument is an uninitialized value
           rc = handle_fsi2pib_status(scom, status);
                ^                           ~~~~~~
   drivers/fsi/fsi-scom.c:327:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = &scom->fsi_dev->dev;
                          ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:327:17: note: Value stored to 'dev' during its initialization is never read
           struct device *dev = &scom->fsi_dev->dev;
                          ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:357:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = &scom->fsi_dev->dev;
                          ^~~   ~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:357:17: note: Value stored to 'dev' during its initialization is never read
           struct device *dev = &scom->fsi_dev->dev;
                          ^~~   ~~~~~~~~~~~~~~~~~~~
   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.
   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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
>> drivers/perf/arm_smmuv3_pmu.c:349:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = smmu_pmu->dev;
                          ^~~   ~~~~~~~~~~~~~
   drivers/perf/arm_smmuv3_pmu.c:349:17: note: Value stored to 'dev' during its initialization is never read
           struct device *dev = smmu_pmu->dev;
                          ^~~   ~~~~~~~~~~~~~
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   drivers/hwtracing/intel_th/msu.c:860:2: warning: Value stored to 'reg' is never read [clang-analyzer-deadcode.DeadStores]
           reg = ioread32(msc->reg_base + REG_MSU_MSC0STS);
           ^
   drivers/hwtracing/intel_th/msu.c:860:2: note: Value stored to 'reg' is never read
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   28 warnings generated.
   drivers/md/bcache/sysfs.c:204:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           sysfs_hprint(writeback_rate,
           ^
   drivers/md/bcache/sysfs.h:67:3: note: expanded from macro 'sysfs_hprint'
                   strcat(buf, "\n");                                      \
                   ^~~~~~
   drivers/md/bcache/sysfs.c:204:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
           sysfs_hprint(writeback_rate,
           ^
   drivers/md/bcache/sysfs.h:67:3: note: expanded from macro 'sysfs_hprint'
                   strcat(buf, "\n");                                      \
                   ^~~~~~
   drivers/md/bcache/sysfs.c:255:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           sysfs_hprint(dirty_data,
           ^
   drivers/md/bcache/sysfs.h:67:3: note: expanded from macro 'sysfs_hprint'
                   strcat(buf, "\n");                                      \
                   ^~~~~~
   drivers/md/bcache/sysfs.c:255:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
           sysfs_hprint(dirty_data,
           ^
   drivers/md/bcache/sysfs.h:67:3: note: expanded from macro 'sysfs_hprint'
                   strcat(buf, "\n");                                      \
                   ^~~~~~
   drivers/md/bcache/sysfs.c:258:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           sysfs_hprint(stripe_size,        ((uint64_t)dc->disk.stripe_size) << 9);
           ^
   drivers/md/bcache/sysfs.h:67:3: note: expanded from macro 'sysfs_hprint'
                   strcat(buf, "\n");                                      \
                   ^~~~~~
   drivers/md/bcache/sysfs.c:258:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
           sysfs_hprint(stripe_size,        ((uint64_t)dc->disk.stripe_size) << 9);
           ^
   drivers/md/bcache/sysfs.h:67:3: note: expanded from macro 'sysfs_hprint'
                   strcat(buf, "\n");                                      \
                   ^~~~~~
   drivers/md/bcache/sysfs.c:261:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           var_hprint(sequential_cutoff);
           ^
   drivers/md/bcache/sysfs.h:74:26: note: expanded from macro 'var_hprint'
   #define var_hprint(_var)        sysfs_hprint(_var, var(_var))
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/md/bcache/sysfs.h:67:3: note: expanded from macro 'sysfs_hprint'
                   strcat(buf, "\n");                                      \
                   ^~~~~~
   drivers/md/bcache/sysfs.c:261:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
           var_hprint(sequential_cutoff);
           ^
   drivers/md/bcache/sysfs.h:74:26: note: expanded from macro 'var_hprint'
   #define var_hprint(_var)        sysfs_hprint(_var, var(_var))
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/md/bcache/sysfs.h:67:3: note: expanded from macro 'sysfs_hprint'
                   strcat(buf, "\n");                                      \
                   ^~~~~~
   drivers/md/bcache/sysfs.c:269:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   strcat(buf, "\n");
                   ^~~~~~
   drivers/md/bcache/sysfs.c:269:3: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
                   strcat(buf, "\n");
                   ^~~~~~
   drivers/md/bcache/sysfs.c:275:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]

vim +/dev +349 drivers/perf/arm_smmuv3_pmu.c

3c9347351a6ea1 Robin Murphy 2019-08-01  339  
7d839b4b9e0064 Neil Leeder  2019-03-26  340  /*
7d839b4b9e0064 Neil Leeder  2019-03-26  341   * Implementation of abstract pmu functionality required by
7d839b4b9e0064 Neil Leeder  2019-03-26  342   * the core perf events code.
7d839b4b9e0064 Neil Leeder  2019-03-26  343   */
7d839b4b9e0064 Neil Leeder  2019-03-26  344  
7d839b4b9e0064 Neil Leeder  2019-03-26  345  static int smmu_pmu_event_init(struct perf_event *event)
7d839b4b9e0064 Neil Leeder  2019-03-26  346  {
7d839b4b9e0064 Neil Leeder  2019-03-26  347  	struct hw_perf_event *hwc = &event->hw;
7d839b4b9e0064 Neil Leeder  2019-03-26  348  	struct smmu_pmu *smmu_pmu = to_smmu_pmu(event->pmu);
7d839b4b9e0064 Neil Leeder  2019-03-26 @349  	struct device *dev = smmu_pmu->dev;
7d839b4b9e0064 Neil Leeder  2019-03-26  350  	struct perf_event *sibling;
33e84ea4330da8 Robin Murphy 2019-08-01  351  	int group_num_events = 1;
7d839b4b9e0064 Neil Leeder  2019-03-26  352  	u16 event_id;
7d839b4b9e0064 Neil Leeder  2019-03-26  353  
7d839b4b9e0064 Neil Leeder  2019-03-26  354  	if (event->attr.type != event->pmu->type)
7d839b4b9e0064 Neil Leeder  2019-03-26  355  		return -ENOENT;
7d839b4b9e0064 Neil Leeder  2019-03-26  356  
7d839b4b9e0064 Neil Leeder  2019-03-26  357  	if (hwc->sample_period) {
7d839b4b9e0064 Neil Leeder  2019-03-26  358  		dev_dbg(dev, "Sampling not supported\n");
7d839b4b9e0064 Neil Leeder  2019-03-26  359  		return -EOPNOTSUPP;
7d839b4b9e0064 Neil Leeder  2019-03-26  360  	}
7d839b4b9e0064 Neil Leeder  2019-03-26  361  
7d839b4b9e0064 Neil Leeder  2019-03-26  362  	if (event->cpu < 0) {
7d839b4b9e0064 Neil Leeder  2019-03-26  363  		dev_dbg(dev, "Per-task mode not supported\n");
7d839b4b9e0064 Neil Leeder  2019-03-26  364  		return -EOPNOTSUPP;
7d839b4b9e0064 Neil Leeder  2019-03-26  365  	}
7d839b4b9e0064 Neil Leeder  2019-03-26  366  
7d839b4b9e0064 Neil Leeder  2019-03-26  367  	/* Verify specified event is supported on this PMU */
7d839b4b9e0064 Neil Leeder  2019-03-26  368  	event_id = get_event(event);
7d839b4b9e0064 Neil Leeder  2019-03-26  369  	if (event_id < SMMU_PMCG_ARCH_MAX_EVENTS &&
7d839b4b9e0064 Neil Leeder  2019-03-26  370  	    (!test_bit(event_id, smmu_pmu->supported_events))) {
7d839b4b9e0064 Neil Leeder  2019-03-26  371  		dev_dbg(dev, "Invalid event %d for this PMU\n", event_id);
7d839b4b9e0064 Neil Leeder  2019-03-26  372  		return -EINVAL;
7d839b4b9e0064 Neil Leeder  2019-03-26  373  	}
7d839b4b9e0064 Neil Leeder  2019-03-26  374  
7d839b4b9e0064 Neil Leeder  2019-03-26  375  	/* Don't allow groups with mixed PMUs, except for s/w events */
33e84ea4330da8 Robin Murphy 2019-08-01  376  	if (!is_software_event(event->group_leader)) {
3c9347351a6ea1 Robin Murphy 2019-08-01  377  		if (!smmu_pmu_events_compatible(event->group_leader, event))
33e84ea4330da8 Robin Murphy 2019-08-01  378  			return -EINVAL;
33e84ea4330da8 Robin Murphy 2019-08-01  379  
33e84ea4330da8 Robin Murphy 2019-08-01  380  		if (++group_num_events > smmu_pmu->num_counters)
7d839b4b9e0064 Neil Leeder  2019-03-26  381  			return -EINVAL;
7d839b4b9e0064 Neil Leeder  2019-03-26  382  	}
7d839b4b9e0064 Neil Leeder  2019-03-26  383  
7d839b4b9e0064 Neil Leeder  2019-03-26  384  	for_each_sibling_event(sibling, event->group_leader) {
33e84ea4330da8 Robin Murphy 2019-08-01  385  		if (is_software_event(sibling))
33e84ea4330da8 Robin Murphy 2019-08-01  386  			continue;
33e84ea4330da8 Robin Murphy 2019-08-01  387  
3c9347351a6ea1 Robin Murphy 2019-08-01  388  		if (!smmu_pmu_events_compatible(sibling, event))
33e84ea4330da8 Robin Murphy 2019-08-01  389  			return -EINVAL;
33e84ea4330da8 Robin Murphy 2019-08-01  390  
33e84ea4330da8 Robin Murphy 2019-08-01  391  		if (++group_num_events > smmu_pmu->num_counters)
7d839b4b9e0064 Neil Leeder  2019-03-26  392  			return -EINVAL;
7d839b4b9e0064 Neil Leeder  2019-03-26  393  	}
7d839b4b9e0064 Neil Leeder  2019-03-26  394  
7d839b4b9e0064 Neil Leeder  2019-03-26  395  	hwc->idx = -1;
7d839b4b9e0064 Neil Leeder  2019-03-26  396  
7d839b4b9e0064 Neil Leeder  2019-03-26  397  	/*
7d839b4b9e0064 Neil Leeder  2019-03-26  398  	 * Ensure all events are on the same cpu so all events are in the
7d839b4b9e0064 Neil Leeder  2019-03-26  399  	 * same cpu context, to avoid races on pmu_enable etc.
7d839b4b9e0064 Neil Leeder  2019-03-26  400  	 */
7d839b4b9e0064 Neil Leeder  2019-03-26  401  	event->cpu = smmu_pmu->on_cpu;
7d839b4b9e0064 Neil Leeder  2019-03-26  402  
7d839b4b9e0064 Neil Leeder  2019-03-26  403  	return 0;
7d839b4b9e0064 Neil Leeder  2019-03-26  404  }
7d839b4b9e0064 Neil Leeder  2019-03-26  405  

:::::: The code at line 349 was first introduced by commit
:::::: 7d839b4b9e00645e49345d6ce5dfa8edf53c1a21 perf/smmuv3: Add arm64 smmuv3 pmu driver

:::::: TO: Neil Leeder <nleeder@codeaurora.org>
:::::: CC: Will Deacon <will.deacon@arm.com>

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

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

* drivers/perf/arm_smmuv3_pmu.c:349:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-03-19  1:04 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-03-19  1:04 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 19433 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: John Garry <john.garry@huawei.com>
CC: Will Deacon <will@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   34e047aa16c0123bbae8e2f6df33e5ecc1f56601
commit: e656972b69864348a747954ea187576808000c5a drivers/perf: Improve build test coverage
date:   6 months ago
:::::: branch date: 6 hours ago
:::::: commit date: 6 months ago
config: riscv-randconfig-c006-20220313 (https://download.01.org/0day-ci/archive/20220319/202203190951.JIEz5n06-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 43f668b98e8d87290fc6bbf5ed13c3ab542e3497)
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=e656972b69864348a747954ea187576808000c5a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e656972b69864348a747954ea187576808000c5a
        # save the config file 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/uapi/linux/byteorder/little_endian.h:40:26: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                            ^
   include/uapi/linux/swab.h:118:2: note: expanded from macro '__swab32'
           (__builtin_constant_p((__u32)(x)) ?     \
           ^
   fs/xfs/libxfs/xfs_dir2_node.c:824:2: note: Loop condition is true.  Entering loop body
           for (lep = &leafhdr.ents[index];
           ^
   fs/xfs/libxfs/xfs_dir2_node.c:830:7: note: '?' condition is false
                   if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR)
                       ^
   include/linux/byteorder/generic.h:95:21: note: expanded from macro 'be32_to_cpu'
   #define be32_to_cpu __be32_to_cpu
                       ^
   include/uapi/linux/byteorder/little_endian.h:40:26: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                            ^
   include/uapi/linux/swab.h:118:3: note: expanded from macro '__swab32'
           (__builtin_constant_p((__u32)(x)) ?     \
            ^
   fs/xfs/libxfs/xfs_dir2_node.c:830:7: note: Assuming the condition is false
                   if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR)
                       ^
   include/linux/byteorder/generic.h:95:21: note: expanded from macro 'be32_to_cpu'
   #define be32_to_cpu __be32_to_cpu
                       ^
   include/uapi/linux/byteorder/little_endian.h:40:26: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                            ^
   include/uapi/linux/swab.h:118:2: note: expanded from macro '__swab32'
           (__builtin_constant_p((__u32)(x)) ?     \
           ^
   fs/xfs/libxfs/xfs_dir2_node.c:830:3: note: Taking false branch
                   if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR)
                   ^
   fs/xfs/libxfs/xfs_dir2_node.c:836:13: note: '?' condition is false
                                                  be32_to_cpu(lep->address));
                                                  ^
   include/linux/byteorder/generic.h:95:21: note: expanded from macro 'be32_to_cpu'
   #define be32_to_cpu __be32_to_cpu
                       ^
   include/uapi/linux/byteorder/little_endian.h:40:26: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                            ^
   include/uapi/linux/swab.h:118:3: note: expanded from macro '__swab32'
           (__builtin_constant_p((__u32)(x)) ?     \
            ^
   fs/xfs/libxfs/xfs_dir2_node.c:843:7: note: Assuming 'newdb' is equal to 'curdb'
                   if (newdb != curdb) {
                       ^~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_dir2_node.c:843:3: note: Taking false branch
                   if (newdb != curdb) {
                   ^
   fs/xfs/libxfs/xfs_dir2_node.c:873:43: note: Access to field 'b_addr' results in a dereference of a null pointer (loaded from variable 'curbp')
                   dep = (xfs_dir2_data_entry_t *)((char *)curbp->b_addr +
                                                           ^~~~~
   fs/xfs/libxfs/xfs_dir2_node.c:1510:2: warning: Value stored to 'ents' is never read [clang-analyzer-deadcode.DeadStores]
           ents = leafhdr.ents;
           ^      ~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_dir2_node.c:1510:2: note: Value stored to 'ents' is never read
           ents = leafhdr.ents;
           ^      ~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_dir2_node.c:1572:3: warning: Value stored to 'ents' is never read [clang-analyzer-deadcode.DeadStores]
                   ents = hdr2.ents;
                   ^      ~~~~~~~~~
   fs/xfs/libxfs/xfs_dir2_node.c:1572:3: note: Value stored to 'ents' is never read
                   ents = hdr2.ents;
                   ^      ~~~~~~~~~
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
>> drivers/perf/arm_smmuv3_pmu.c:349:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = smmu_pmu->dev;
                          ^~~   ~~~~~~~~~~~~~
   drivers/perf/arm_smmuv3_pmu.c:349:17: note: Value stored to 'dev' during its initialization is never read
           struct device *dev = smmu_pmu->dev;
                          ^~~   ~~~~~~~~~~~~~
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   drivers/hwtracing/intel_th/msu.c:860:2: warning: Value stored to 'reg' is never read [clang-analyzer-deadcode.DeadStores]
           reg = ioread32(msc->reg_base + REG_MSU_MSC0STS);
           ^
   drivers/hwtracing/intel_th/msu.c:860:2: note: Value stored to 'reg' is never read
   Suppressed 9 warnings (2 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.
   9 warnings generated.
   Suppressed 9 warnings (2 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.
   10 warnings generated.
   Suppressed 10 warnings (3 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.
   10 warnings generated.
   include/linux/hid.h:1007:9: warning: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input') [clang-analyzer-core.NullDereference]
                                       input->name, c, type);
                                       ^
   drivers/hid/hid-chicony.c:63:6: note: Assuming the condition is false
           if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-chicony.c:63:2: note: Taking false branch
           if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
           ^
   drivers/hid/hid-chicony.c:67:2: note: Control jumps to 'case 65291:'  at line 78
           switch (usage->hid & HID_USAGE) {
           ^
   drivers/hid/hid-chicony.c:78:15: note: Calling 'hid_map_usage_clear'
           case 0xff0b: ch_map_key_clear(BTN_B);   break;
                        ^
   drivers/hid/hid-chicony.c:57:29: note: expanded from macro 'ch_map_key_clear'
   #define ch_map_key_clear(c)     hid_map_usage_clear(hi, usage, bit, max, \
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1035:2: note: Calling 'hid_map_usage'
           hid_map_usage(hidinput, usage, bit, max, type, c);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:982:2: note: 'input' initialized here
           struct input_dev *input = hidinput->input;
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:986:2: note: Control jumps to 'case 1:'  at line 995
           switch (type) {
           ^
   include/linux/hid.h:998:3: note:  Execution continues on line 1005
                   break;
                   ^
   include/linux/hid.h:1005:15: note: 'c' is <= 'limit'
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:15: note: Left side of '||' is false
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/hid.h:1005:28: note: Assuming 'bmap' is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:28: note: Assuming pointer value is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:2: note: Taking true branch
           if (unlikely(c > limit || !bmap)) {
           ^
   include/linux/hid.h:1006:3: note: Assuming the condition is true
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:656:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:639:6: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
               ^~~~~~~~~~~~~~~~~
   include/linux/ratelimit_types.h:41:28: note: expanded from macro '__ratelimit'
   #define __ratelimit(state) ___ratelimit(state, __func__)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1006:3: note: Taking true branch
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:656:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:639:2: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
           ^
   include/linux/hid.h:1006:3: note: Loop condition is false.  Exiting loop

vim +/dev +349 drivers/perf/arm_smmuv3_pmu.c

3c9347351a6ea12 Robin Murphy 2019-08-01  339  
7d839b4b9e00645 Neil Leeder  2019-03-26  340  /*
7d839b4b9e00645 Neil Leeder  2019-03-26  341   * Implementation of abstract pmu functionality required by
7d839b4b9e00645 Neil Leeder  2019-03-26  342   * the core perf events code.
7d839b4b9e00645 Neil Leeder  2019-03-26  343   */
7d839b4b9e00645 Neil Leeder  2019-03-26  344  
7d839b4b9e00645 Neil Leeder  2019-03-26  345  static int smmu_pmu_event_init(struct perf_event *event)
7d839b4b9e00645 Neil Leeder  2019-03-26  346  {
7d839b4b9e00645 Neil Leeder  2019-03-26  347  	struct hw_perf_event *hwc = &event->hw;
7d839b4b9e00645 Neil Leeder  2019-03-26  348  	struct smmu_pmu *smmu_pmu = to_smmu_pmu(event->pmu);
7d839b4b9e00645 Neil Leeder  2019-03-26 @349  	struct device *dev = smmu_pmu->dev;
7d839b4b9e00645 Neil Leeder  2019-03-26  350  	struct perf_event *sibling;
33e84ea4330da8a Robin Murphy 2019-08-01  351  	int group_num_events = 1;
7d839b4b9e00645 Neil Leeder  2019-03-26  352  	u16 event_id;
7d839b4b9e00645 Neil Leeder  2019-03-26  353  
7d839b4b9e00645 Neil Leeder  2019-03-26  354  	if (event->attr.type != event->pmu->type)
7d839b4b9e00645 Neil Leeder  2019-03-26  355  		return -ENOENT;
7d839b4b9e00645 Neil Leeder  2019-03-26  356  
7d839b4b9e00645 Neil Leeder  2019-03-26  357  	if (hwc->sample_period) {
7d839b4b9e00645 Neil Leeder  2019-03-26  358  		dev_dbg(dev, "Sampling not supported\n");
7d839b4b9e00645 Neil Leeder  2019-03-26  359  		return -EOPNOTSUPP;
7d839b4b9e00645 Neil Leeder  2019-03-26  360  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  361  
7d839b4b9e00645 Neil Leeder  2019-03-26  362  	if (event->cpu < 0) {
7d839b4b9e00645 Neil Leeder  2019-03-26  363  		dev_dbg(dev, "Per-task mode not supported\n");
7d839b4b9e00645 Neil Leeder  2019-03-26  364  		return -EOPNOTSUPP;
7d839b4b9e00645 Neil Leeder  2019-03-26  365  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  366  
7d839b4b9e00645 Neil Leeder  2019-03-26  367  	/* Verify specified event is supported on this PMU */
7d839b4b9e00645 Neil Leeder  2019-03-26  368  	event_id = get_event(event);
7d839b4b9e00645 Neil Leeder  2019-03-26  369  	if (event_id < SMMU_PMCG_ARCH_MAX_EVENTS &&
7d839b4b9e00645 Neil Leeder  2019-03-26  370  	    (!test_bit(event_id, smmu_pmu->supported_events))) {
7d839b4b9e00645 Neil Leeder  2019-03-26  371  		dev_dbg(dev, "Invalid event %d for this PMU\n", event_id);
7d839b4b9e00645 Neil Leeder  2019-03-26  372  		return -EINVAL;
7d839b4b9e00645 Neil Leeder  2019-03-26  373  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  374  
7d839b4b9e00645 Neil Leeder  2019-03-26  375  	/* Don't allow groups with mixed PMUs, except for s/w events */
33e84ea4330da8a Robin Murphy 2019-08-01  376  	if (!is_software_event(event->group_leader)) {
3c9347351a6ea12 Robin Murphy 2019-08-01  377  		if (!smmu_pmu_events_compatible(event->group_leader, event))
33e84ea4330da8a Robin Murphy 2019-08-01  378  			return -EINVAL;
33e84ea4330da8a Robin Murphy 2019-08-01  379  
33e84ea4330da8a Robin Murphy 2019-08-01  380  		if (++group_num_events > smmu_pmu->num_counters)
7d839b4b9e00645 Neil Leeder  2019-03-26  381  			return -EINVAL;
7d839b4b9e00645 Neil Leeder  2019-03-26  382  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  383  
7d839b4b9e00645 Neil Leeder  2019-03-26  384  	for_each_sibling_event(sibling, event->group_leader) {
33e84ea4330da8a Robin Murphy 2019-08-01  385  		if (is_software_event(sibling))
33e84ea4330da8a Robin Murphy 2019-08-01  386  			continue;
33e84ea4330da8a Robin Murphy 2019-08-01  387  
3c9347351a6ea12 Robin Murphy 2019-08-01  388  		if (!smmu_pmu_events_compatible(sibling, event))
33e84ea4330da8a Robin Murphy 2019-08-01  389  			return -EINVAL;
33e84ea4330da8a Robin Murphy 2019-08-01  390  
33e84ea4330da8a Robin Murphy 2019-08-01  391  		if (++group_num_events > smmu_pmu->num_counters)
7d839b4b9e00645 Neil Leeder  2019-03-26  392  			return -EINVAL;
7d839b4b9e00645 Neil Leeder  2019-03-26  393  	}
7d839b4b9e00645 Neil Leeder  2019-03-26  394  
7d839b4b9e00645 Neil Leeder  2019-03-26  395  	hwc->idx = -1;
7d839b4b9e00645 Neil Leeder  2019-03-26  396  
7d839b4b9e00645 Neil Leeder  2019-03-26  397  	/*
7d839b4b9e00645 Neil Leeder  2019-03-26  398  	 * Ensure all events are on the same cpu so all events are in the
7d839b4b9e00645 Neil Leeder  2019-03-26  399  	 * same cpu context, to avoid races on pmu_enable etc.
7d839b4b9e00645 Neil Leeder  2019-03-26  400  	 */
7d839b4b9e00645 Neil Leeder  2019-03-26  401  	event->cpu = smmu_pmu->on_cpu;
7d839b4b9e00645 Neil Leeder  2019-03-26  402  
7d839b4b9e00645 Neil Leeder  2019-03-26  403  	return 0;
7d839b4b9e00645 Neil Leeder  2019-03-26  404  }
7d839b4b9e00645 Neil Leeder  2019-03-26  405  

:::::: The code at line 349 was first introduced by commit
:::::: 7d839b4b9e00645e49345d6ce5dfa8edf53c1a21 perf/smmuv3: Add arm64 smmuv3 pmu driver

:::::: TO: Neil Leeder <nleeder@codeaurora.org>
:::::: CC: Will Deacon <will.deacon@arm.com>

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

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

end of thread, other threads:[~2022-03-20 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 13:44 drivers/perf/arm_smmuv3_pmu.c:349:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
2022-03-19  1:04 kernel test robot
2022-03-20 18:14 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.