[kvalo-ath:pending 52/56] drivers/net/wireless/ath/ath11k/wmi.c:5651 ath11k_wmi_tlv_fw_stats_data_parse() error: uninitialized symbol 'len'.

Dan Carpenter dan.carpenter at oracle.com
Wed Jan 5 04:21:42 PST 2022


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git pending
head:   34cbb4043dca455fca888e1ced323e588912b6a2
commit: bc5c448b70ff141f8a2b5cbbab79fba08d7a1be0 [52/56] ath11k: report rssi of each chain to mac80211 for QCA6390/WCN6855
config: riscv-randconfig-m031-20211210 (https://download.01.org/0day-ci/archive/20211211/202112110427.o6xDAKfE-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>

New smatch warnings:
drivers/net/wireless/ath/ath11k/wmi.c:5651 ath11k_wmi_tlv_fw_stats_data_parse() error: uninitialized symbol 'len'.

Old smatch warnings:
arch/riscv/include/asm/atomic.h:317 arch_atomic_sub_if_positive() warn: inconsistent indenting
drivers/net/wireless/ath/ath11k/wmi.c:5674 ath11k_wmi_tlv_fw_stats_data_parse() error: uninitialized symbol 'len'.
drivers/net/wireless/ath/ath11k/wmi.c:5695 ath11k_wmi_tlv_fw_stats_data_parse() error: uninitialized symbol 'len'.

vim +/len +5651 drivers/net/wireless/ath/ath11k/wmi.c

bc5c448b70ff14 Wen Gong   2021-12-08  5629  static int ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab,
bc5c448b70ff14 Wen Gong   2021-12-08  5630  					      struct wmi_tlv_fw_stats_parse *parse,
bc5c448b70ff14 Wen Gong   2021-12-08  5631  					      const void *ptr)
bc5c448b70ff14 Wen Gong   2021-12-08  5632  {
bc5c448b70ff14 Wen Gong   2021-12-08  5633  	struct ath11k_fw_stats *stats = parse->stats;
bc5c448b70ff14 Wen Gong   2021-12-08  5634  	const struct wmi_stats_event *ev = parse->ev;
bc5c448b70ff14 Wen Gong   2021-12-08  5635  	int i;
bc5c448b70ff14 Wen Gong   2021-12-08  5636  	const void *data = ptr;
bc5c448b70ff14 Wen Gong   2021-12-08  5637  	u32 len;
bc5c448b70ff14 Wen Gong   2021-12-08  5638  
bc5c448b70ff14 Wen Gong   2021-12-08  5639  	if (!ev) {
bc5c448b70ff14 Wen Gong   2021-12-08  5640  		ath11k_warn(ab, "failed to fetch update stats ev");
bc5c448b70ff14 Wen Gong   2021-12-08  5641  		return -EPROTO;
bc5c448b70ff14 Wen Gong   2021-12-08  5642  	}
d5c65159f28953 Kalle Valo 2019-11-23  5643  
d5c65159f28953 Kalle Valo 2019-11-23  5644  	stats->stats_id = 0;
d5c65159f28953 Kalle Valo 2019-11-23  5645  
d5c65159f28953 Kalle Valo 2019-11-23  5646  	for (i = 0; i < ev->num_pdev_stats; i++) {
d5c65159f28953 Kalle Valo 2019-11-23  5647  		const struct wmi_pdev_stats *src;
d5c65159f28953 Kalle Valo 2019-11-23  5648  		struct ath11k_fw_stats_pdev *dst;
d5c65159f28953 Kalle Valo 2019-11-23  5649  
d5c65159f28953 Kalle Valo 2019-11-23  5650  		src = data;
bc5c448b70ff14 Wen Gong   2021-12-08 @5651  		if (len < sizeof(*src))

"len" is never initialized.

d5c65159f28953 Kalle Valo 2019-11-23  5652  			return -EPROTO;
d5c65159f28953 Kalle Valo 2019-11-23  5653  
d5c65159f28953 Kalle Valo 2019-11-23  5654  		stats->stats_id = WMI_REQUEST_PDEV_STAT;
d5c65159f28953 Kalle Valo 2019-11-23  5655  
d5c65159f28953 Kalle Valo 2019-11-23  5656  		data += sizeof(*src);
d5c65159f28953 Kalle Valo 2019-11-23  5657  		len -= sizeof(*src);
d5c65159f28953 Kalle Valo 2019-11-23  5658  
d5c65159f28953 Kalle Valo 2019-11-23  5659  		dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
d5c65159f28953 Kalle Valo 2019-11-23  5660  		if (!dst)
d5c65159f28953 Kalle Valo 2019-11-23  5661  			continue;
d5c65159f28953 Kalle Valo 2019-11-23  5662  
d5c65159f28953 Kalle Valo 2019-11-23  5663  		ath11k_wmi_pull_pdev_stats_base(&src->base, dst);
d5c65159f28953 Kalle Valo 2019-11-23  5664  		ath11k_wmi_pull_pdev_stats_tx(&src->tx, dst);
d5c65159f28953 Kalle Valo 2019-11-23  5665  		ath11k_wmi_pull_pdev_stats_rx(&src->rx, dst);
d5c65159f28953 Kalle Valo 2019-11-23  5666  		list_add_tail(&dst->list, &stats->pdevs);
d5c65159f28953 Kalle Valo 2019-11-23  5667  	}
d5c65159f28953 Kalle Valo 2019-11-23  5668  
d5c65159f28953 Kalle Valo 2019-11-23  5669  	for (i = 0; i < ev->num_vdev_stats; i++) {
d5c65159f28953 Kalle Valo 2019-11-23  5670  		const struct wmi_vdev_stats *src;
d5c65159f28953 Kalle Valo 2019-11-23  5671  		struct ath11k_fw_stats_vdev *dst;
d5c65159f28953 Kalle Valo 2019-11-23  5672  
d5c65159f28953 Kalle Valo 2019-11-23  5673  		src = data;
bc5c448b70ff14 Wen Gong   2021-12-08  5674  		if (len < sizeof(*src))
d5c65159f28953 Kalle Valo 2019-11-23  5675  			return -EPROTO;
d5c65159f28953 Kalle Valo 2019-11-23  5676  
d5c65159f28953 Kalle Valo 2019-11-23  5677  		stats->stats_id = WMI_REQUEST_VDEV_STAT;
d5c65159f28953 Kalle Valo 2019-11-23  5678  
d5c65159f28953 Kalle Valo 2019-11-23  5679  		data += sizeof(*src);
d5c65159f28953 Kalle Valo 2019-11-23  5680  		len -= sizeof(*src);
d5c65159f28953 Kalle Valo 2019-11-23  5681  
d5c65159f28953 Kalle Valo 2019-11-23  5682  		dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
d5c65159f28953 Kalle Valo 2019-11-23  5683  		if (!dst)
d5c65159f28953 Kalle Valo 2019-11-23  5684  			continue;
d5c65159f28953 Kalle Valo 2019-11-23  5685  
d5c65159f28953 Kalle Valo 2019-11-23  5686  		ath11k_wmi_pull_vdev_stats(src, dst);
d5c65159f28953 Kalle Valo 2019-11-23  5687  		list_add_tail(&dst->list, &stats->vdevs);
d5c65159f28953 Kalle Valo 2019-11-23  5688  	}
d5c65159f28953 Kalle Valo 2019-11-23  5689  
d5c65159f28953 Kalle Valo 2019-11-23  5690  	for (i = 0; i < ev->num_bcn_stats; i++) {
d5c65159f28953 Kalle Valo 2019-11-23  5691  		const struct wmi_bcn_stats *src;
d5c65159f28953 Kalle Valo 2019-11-23  5692  		struct ath11k_fw_stats_bcn *dst;
d5c65159f28953 Kalle Valo 2019-11-23  5693  
d5c65159f28953 Kalle Valo 2019-11-23  5694  		src = data;
bc5c448b70ff14 Wen Gong   2021-12-08  5695  		if (len < sizeof(*src))
d5c65159f28953 Kalle Valo 2019-11-23  5696  			return -EPROTO;
d5c65159f28953 Kalle Valo 2019-11-23  5697  
d5c65159f28953 Kalle Valo 2019-11-23  5698  		stats->stats_id = WMI_REQUEST_BCN_STAT;
d5c65159f28953 Kalle Valo 2019-11-23  5699  
d5c65159f28953 Kalle Valo 2019-11-23  5700  		data += sizeof(*src);
d5c65159f28953 Kalle Valo 2019-11-23  5701  		len -= sizeof(*src);
d5c65159f28953 Kalle Valo 2019-11-23  5702  
d5c65159f28953 Kalle Valo 2019-11-23  5703  		dst = kzalloc(sizeof(*dst), GFP_ATOMIC);
d5c65159f28953 Kalle Valo 2019-11-23  5704  		if (!dst)
d5c65159f28953 Kalle Valo 2019-11-23  5705  			continue;
d5c65159f28953 Kalle Valo 2019-11-23  5706  
d5c65159f28953 Kalle Valo 2019-11-23  5707  		ath11k_wmi_pull_bcn_stats(src, dst);
d5c65159f28953 Kalle Valo 2019-11-23  5708  		list_add_tail(&dst->list, &stats->bcn);
d5c65159f28953 Kalle Valo 2019-11-23  5709  	}
d5c65159f28953 Kalle Valo 2019-11-23  5710  
d5c65159f28953 Kalle Valo 2019-11-23  5711  	return 0;
d5c65159f28953 Kalle Valo 2019-11-23  5712  }

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




More information about the ath10k mailing list