@@ -999,6 +999,9 @@ int ibv_cmd_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
tmp->wr.ud.ah = i->wr.ud.ah->handle;
tmp->wr.ud.remote_qpn = i->wr.ud.remote_qpn;
tmp->wr.ud.remote_qkey = i->wr.ud.remote_qkey;
+ memset(&tmp->wr.ud.reserved, 0,
+ sizeof(tmp->wr.ud.reserved)
+ + (sizeof(tmp->wr) - sizeof(tmp->wr.ud)));
} else {
switch (i->opcode) {
case IBV_WR_RDMA_WRITE:
@@ -1007,6 +1010,9 @@ int ibv_cmd_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
tmp->wr.rdma.remote_addr =
i->wr.rdma.remote_addr;
tmp->wr.rdma.rkey = i->wr.rdma.rkey;
+ memset(&tmp->wr.rdma.reserved, 0,
+ sizeof(tmp->wr.rdma.reserved)
+ + (sizeof(tmp->wr) - sizeof(tmp->wr.rdma)));
break;
case IBV_WR_ATOMIC_CMP_AND_SWP:
case IBV_WR_ATOMIC_FETCH_AND_ADD:
@@ -1016,8 +1022,12 @@ int ibv_cmd_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
i->wr.atomic.compare_add;
tmp->wr.atomic.swap = i->wr.atomic.swap;
tmp->wr.atomic.rkey = i->wr.atomic.rkey;
+ memset(&tmp->wr.atomic.reserved, 0,
+ sizeof(tmp->wr.atomic.reserved)
+ + (sizeof(tmp->wr) - sizeof(tmp->wr.atomic)));
break;
default:
+ memset(&tmp->wr, 0, sizeof(tmp->wr));
break;
}
}
Properly initialize data structure exchanged with kernel uverbs layer: - may remove valgrind spurious warnings; - may allow to use the field later for future expansion. Link: http://marc.info/?i=cover.1412163687.git.ydroneaud@opteya.com Fixes: eb0663777c24 ('Add support for new datapath kernel commands') Signed-off-by: Yann Droneaud <ydroneaud@opteya.com> --- src/cmd.c | 10 ++++++++++ 1 file changed, 10 insertions(+)