From 146a980b0669d6db58ac4b5e83efa951ea48ddae Mon Sep 17 00:00:00 2001
From: Junxian Huang <huangjunxian6@hisilicon.com>
Date: Thu, 18 Apr 2024 13:49:34 +0800
Subject: [PATCH 32/33] libhns: Clean up signed-unsigned mix with relational
 issue

mainline inclusion
from mainline-master
commit 79475124d39a92819030a854b7ea94fb73d9bc39
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9NZME
CVE: NA

Reference: https://github.com/linux-rdma/rdma-core/pull/1450/commits/79475124d39a92819030a854b7ea94fb73d9bc39

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

Clean up signed-unsigned mix with relational issue.

Fixes: 36446a56eea5 ("libhns: Extended QP supports the new post send mechanism")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Juan Zhou <zhoujuan51@h-partners.com>
---
 providers/hns/hns_roce_u_hw_v2.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index a0b8655..9371150 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -2632,8 +2632,8 @@ static void set_inline_data_list_rc(struct hns_roce_qp *qp,
 {
 	unsigned int msg_len = qp->sge_info.total_len;
 	void *dseg;
+	size_t i;
 	int ret;
-	int i;
 
 	hr_reg_enable(wqe, RCWQE_INLINE);
 
@@ -2692,7 +2692,7 @@ static void wr_set_inline_data_list_rc(struct ibv_qp_ex *ibv_qp, size_t num_buf,
 {
 	struct hns_roce_qp *qp = to_hr_qp(&ibv_qp->qp_base);
 	struct hns_roce_rc_sq_wqe *wqe = qp->cur_wqe;
-	int i;
+	size_t i;
 
 	if (!wqe)
 		return;
@@ -2822,7 +2822,7 @@ static void wr_set_sge_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_sge,
 	}
 
 	hr_reg_write(wqe, UDWQE_MSG_START_SGE_IDX, sge_idx & mask);
-	for (int i = 0; i < num_sge; i++) {
+	for (size_t i = 0; i < num_sge; i++) {
 		if (!sg_list[i].length)
 			continue;
 
@@ -2848,8 +2848,8 @@ static void set_inline_data_list_ud(struct hns_roce_qp *qp,
 	uint8_t data[HNS_ROCE_MAX_UD_INL_INN_SZ] = {};
 	unsigned int msg_len = qp->sge_info.total_len;
 	void *tmp;
+	size_t i;
 	int ret;
-	int i;
 
 	if (!check_inl_data_len(qp, msg_len)) {
 		qp->err = EINVAL;
@@ -2910,7 +2910,7 @@ static void wr_set_inline_data_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_buf,
 {
 	struct hns_roce_qp *qp = to_hr_qp(&ibv_qp->qp_base);
 	struct hns_roce_ud_sq_wqe *wqe = qp->cur_wqe;
-	int i;
+	size_t i;
 
 	if (!wqe)
 		return;
-- 
2.33.0

