The issues mainly lies in the memory empty check, variable range inconsistency, parameter verification, and print format. Signed-off-by: Luoyouming <luoyouming@huawei.com> Signed-off-by: Chengchang Tang <tangchengchang@huawei.com Signed-off-by: Ran Zhou <zhouran10@h-partners.com> (cherry picked from commit 918525387673e173835fd287995470cbaccad784)
64 lines
2.2 KiB
Diff
64 lines
2.2 KiB
Diff
From 57499cbc906ec4065f65bb8dfda56081a799746e Mon Sep 17 00:00:00 2001
|
|
From: Chengchang Tang <tangchengchang@huawei.com>
|
|
Date: Mon, 27 Nov 2023 16:39:51 +0800
|
|
Subject: [PATCH 73/75] libhns: Fix uninitialized qp attr when flush cqe
|
|
|
|
driver inclusion
|
|
category: bugfix
|
|
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I8J2XW?from=project-issue
|
|
|
|
--------------------------------------------------------------------------
|
|
|
|
When flushing cqe, the state of qp needs to be modified. The incoming qp
|
|
attr is not initialized, which may lead to undefined behavior.
|
|
|
|
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
|
---
|
|
providers/hns/hns_roce_u_hw_v2.c | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
|
|
index 754f918..b48cabd 100644
|
|
--- a/providers/hns/hns_roce_u_hw_v2.c
|
|
+++ b/providers/hns/hns_roce_u_hw_v2.c
|
|
@@ -405,7 +405,7 @@ static int hns_roce_u_v2_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
|
|
|
|
static int hns_roce_flush_cqe(struct hns_roce_qp *hr_qp, uint8_t status)
|
|
{
|
|
- struct ibv_qp_attr attr;
|
|
+ struct ibv_qp_attr attr = {};
|
|
int attr_mask;
|
|
|
|
if (status != HNS_ROCE_V2_CQE_WR_FLUSH_ERR) {
|
|
@@ -1614,8 +1614,8 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
|
|
struct hns_roce_qp *qp = to_hr_qp(ibvqp);
|
|
struct hns_roce_sge_info sge_info = {};
|
|
struct hns_roce_rc_sq_wqe *wqe;
|
|
+ struct ibv_qp_attr attr = {};
|
|
unsigned int wqe_idx, nreq;
|
|
- struct ibv_qp_attr attr;
|
|
int ret;
|
|
|
|
ret = check_qp_send(qp, ctx);
|
|
@@ -1788,7 +1788,7 @@ static int hns_roce_u_v2_post_recv(struct ibv_qp *ibvqp, struct ibv_recv_wr *wr,
|
|
struct hns_roce_context *ctx = to_hr_ctx(ibvqp->context);
|
|
struct hns_roce_qp *qp = to_hr_qp(ibvqp);
|
|
unsigned int wqe_idx, nreq, max_sge;
|
|
- struct ibv_qp_attr attr;
|
|
+ struct ibv_qp_attr attr = {};
|
|
int ret;
|
|
|
|
ret = check_qp_recv(qp, ctx);
|
|
@@ -3021,7 +3021,7 @@ static int wr_complete(struct ibv_qp_ex *ibv_qp)
|
|
struct hns_roce_context *ctx = to_hr_ctx(ibv_qp->qp_base.context);
|
|
struct hns_roce_qp *qp = to_hr_qp(&ibv_qp->qp_base);
|
|
unsigned int nreq = qp->sq.head - qp->rb_sq_head;
|
|
- struct ibv_qp_attr attr;
|
|
+ struct ibv_qp_attr attr = {};
|
|
int err = qp->err;
|
|
|
|
if (err) {
|
|
--
|
|
2.25.1
|
|
|