Skip to content

Commit 87d9e56

Browse files
Dan Carpenterjgunthorpe
authored andcommitted
RDMA/hns: Uninitialized variable in modify_qp_init_to_rtr()
The "dmac" variable is used before it is initialized. Fixes: 494c3b3 ("RDMA/hns: Refactor the QP context filling process related to WQE buffer configure") Link: https://lore.kernel.org/r/20200529083918.GA1298465@mwanda Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 278f74b commit 87d9e56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4030,6 +4030,7 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
40304030
port = (attr_mask & IB_QP_PORT) ? (attr->port_num - 1) : hr_qp->port;
40314031

40324032
smac = (u8 *)hr_dev->dev_addr[port];
4033+
dmac = (u8 *)attr->ah_attr.roce.dmac;
40334034
/* when dmac equals smac or loop_idc is 1, it should loopback */
40344035
if (ether_addr_equal_unaligned(dmac, smac) ||
40354036
hr_dev->loop_idc == 0x1) {
@@ -4053,7 +4054,6 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
40534054
roce_set_field(qpc_mask->byte_20_smac_sgid_idx,
40544055
V2_QPC_BYTE_20_SGID_IDX_M, V2_QPC_BYTE_20_SGID_IDX_S, 0);
40554056

4056-
dmac = (u8 *)attr->ah_attr.roce.dmac;
40574057
memcpy(&(context->dmac), dmac, sizeof(u32));
40584058
roce_set_field(context->byte_52_udpspn_dmac, V2_QPC_BYTE_52_DMAC_M,
40594059
V2_QPC_BYTE_52_DMAC_S, *((u16 *)(&dmac[4])));

0 commit comments

Comments
 (0)