Skip to content

Commit

Permalink
libhns: Fix uninitialized qp attr when flush cqe
Browse files Browse the repository at this point in the history
[ Upstream commit 23c2104 ]

When flushing cqe, the state of qp needs to be modified. The incoming qp
attr is not initialized, which may lead to undefined behavior.

Fixes: e1726e9 ("libhns: Support flush cqe for hip08 in user space")
Signed-off-by: Chengchang Tang <[email protected]>
Signed-off-by: Junxian Huang <[email protected]>
Signed-off-by: Nicolas Morey <[email protected]>
  • Loading branch information
Chengchang Tang authored and nmorey committed Jan 17, 2024
1 parent c95cc42 commit 5e581b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions providers/hns/hns_roce_u_hw_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,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 **cur_qp, struct ibv_wc *wc)
{
struct ibv_qp_attr attr;
struct ibv_qp_attr attr = {};
int attr_mask;
int ret;

Expand Down Expand Up @@ -962,7 +962,7 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
struct hns_roce_context *ctx = to_hr_ctx(ibvqp->context);
struct hns_roce_qp *qp = to_hr_qp(ibvqp);
struct hns_roce_sge_info sge_info = {};
struct ibv_qp_attr attr;
struct ibv_qp_attr attr = {};
unsigned int wqe_idx;
int attr_mask;
int ret = 0;
Expand Down Expand Up @@ -1047,7 +1047,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_v2_wqe_data_seg *dseg;
struct hns_roce_rinl_sge *sge_list;
struct ibv_qp_attr attr;
struct ibv_qp_attr attr = {};
int attr_mask;
int ret = 0;
int wqe_idx;
Expand Down

0 comments on commit 5e581b5

Please sign in to comment.