Commit 982e092d authored by Junxian Huang's avatar Junxian Huang Committed by zhangyuyang
Browse files

RDMA/hns: Fix restricted __le16 degrades to integer issue

maillist inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAR316
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?id=f4ccc0a2a0c5977540f519588636b5bc81aae2db



----------------------------------------------------------------------

Fix sparse warnings: restricted __le16 degrades to integer.

Fixes: 5a872795 ("RDMA/hns: Support hns HW stats")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409080508.g4mNSLwy-lkp@intel.com/


Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20240909065331.3950268-1-huangjunxian6@hisilicon.com


Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent dd804694
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1845,8 +1845,8 @@ static int hns_roce_hw_v2_query_counter(struct hns_roce_dev *hr_dev,

	for (i = 0; i < HNS_ROCE_HW_CNT_TOTAL && i < *num_counters; i++) {
		bd_idx = i / CNT_PER_DESC;
		if (!(desc[bd_idx].flag & HNS_ROCE_CMD_FLAG_NEXT) &&
		    bd_idx != HNS_ROCE_HW_CNT_TOTAL / CNT_PER_DESC)
		if (bd_idx != HNS_ROCE_HW_CNT_TOTAL / CNT_PER_DESC &&
		    !(desc[bd_idx].flag & cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT)))
			break;

		cnt_data = (__le64 *)&desc[bd_idx].data[0];