Commit 91496e88 authored by Junxian Huang's avatar Junxian Huang Committed by Chengchang Tang
Browse files

RDMA/hns: Fix mixed use of u32 and __le32 in sysfs

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAL7SX



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

lifespan is u32 but is operated with an __le32 in memcpy(). Change
it to __le32 and add le32_to_cpu() where needed.

Fixes: 523f34d8 ("RDMA/hns: Support congestion control algorithm parameter configuration")
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent 6e391aaa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1124,7 +1124,7 @@ struct hns_roce_cnp_pri_param {
#define HNS_ROCE_SCC_PARAM_SIZE 4
struct hns_roce_scc_param {
	__le32 param[HNS_ROCE_SCC_PARAM_SIZE];
	u32 lifespan;
	__le32 lifespan;
	unsigned long timestamp;
	enum hns_roce_scc_algo algo_type;
	struct delayed_work scc_cfg_dwork;
+1 −1
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ static ssize_t scc_attr_store(struct hns_roce_port *pdata,
	if (scc_attr->offset >= offsetof(typeof(*scc_param), lifespan))
		return count;

	lifespan_jiffies = msecs_to_jiffies(scc_param->lifespan);
	lifespan_jiffies = msecs_to_jiffies(le32_to_cpu(scc_param->lifespan));
	exp_time = scc_param->timestamp + lifespan_jiffies;

	if (time_is_before_eq_jiffies(exp_time)) {