lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202409080508.g4mNSLwy-lkp@intel.com>
Date: Sun, 8 Sep 2024 05:49:13 +0800
From: kernel test robot <lkp@...el.com>
To: Chengchang Tang <tangchengchang@...wei.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Leon Romanovsky <leon@...nel.org>,
	Junxian Huang <huangjunxian6@...ilicon.com>
Subject: drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1651:35: sparse: sparse:
 restricted __le16 degrades to integer

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b31c4492884252a8360f312a0ac2049349ddf603
commit: 5a87279591a15f952043209d17429fadab278d47 RDMA/hns: Support hns HW stats
date:   1 year, 1 month ago
config: sparc64-randconfig-r111-20240907 (https://download.01.org/0day-ci/archive/20240908/202409080508.g4mNSLwy-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240908/202409080508.g4mNSLwy-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409080508.g4mNSLwy-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1651:35: sparse: sparse: restricted __le16 degrades to integer
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y

vim +1651 drivers/infiniband/hw/hns/hns_roce_hw_v2.c

  1615	
  1616	static int hns_roce_hw_v2_query_counter(struct hns_roce_dev *hr_dev,
  1617						u64 *stats, u32 port, int *num_counters)
  1618	{
  1619	#define CNT_PER_DESC 3
  1620		struct hns_roce_cmq_desc *desc;
  1621		int bd_idx, cnt_idx;
  1622		__le64 *cnt_data;
  1623		int desc_num;
  1624		int ret;
  1625		int i;
  1626	
  1627		if (port > hr_dev->caps.num_ports)
  1628			return -EINVAL;
  1629	
  1630		desc_num = DIV_ROUND_UP(HNS_ROCE_HW_CNT_TOTAL, CNT_PER_DESC);
  1631		desc = kcalloc(desc_num, sizeof(*desc), GFP_KERNEL);
  1632		if (!desc)
  1633			return -ENOMEM;
  1634	
  1635		for (i = 0; i < desc_num; i++) {
  1636			hns_roce_cmq_setup_basic_desc(&desc[i],
  1637						      HNS_ROCE_OPC_QUERY_COUNTER, true);
  1638			if (i != desc_num - 1)
  1639				desc[i].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
  1640		}
  1641	
  1642		ret = hns_roce_cmq_send(hr_dev, desc, desc_num);
  1643		if (ret) {
  1644			ibdev_err(&hr_dev->ib_dev,
  1645				  "failed to get counter, ret = %d.\n", ret);
  1646			goto err_out;
  1647		}
  1648	
  1649		for (i = 0; i < HNS_ROCE_HW_CNT_TOTAL && i < *num_counters; i++) {
  1650			bd_idx = i / CNT_PER_DESC;
> 1651			if (!(desc[bd_idx].flag & HNS_ROCE_CMD_FLAG_NEXT) &&
  1652			    bd_idx != HNS_ROCE_HW_CNT_TOTAL / CNT_PER_DESC)
  1653				break;
  1654	
  1655			cnt_data = (__le64 *)&desc[bd_idx].data[0];
  1656			cnt_idx = i % CNT_PER_DESC;
  1657			stats[i] = le64_to_cpu(cnt_data[cnt_idx]);
  1658		}
  1659		*num_counters = i;
  1660	
  1661	err_out:
  1662		kfree(desc);
  1663		return ret;
  1664	}
  1665	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ