Skip to content

Commit

Permalink
verbs: Initialize reserved attributes in create AH command
Browse files Browse the repository at this point in the history
Initialize the reserved fields in create AH command to eliminate
valgrind warnings such as:

==18022== Syscall param write(buf) points to uninitialised byte(s)
==18022==    at 0x513A894: write (in /usr/lib64/libc-2.26.so)
==18022==    by 0x4E440C0: _execute_cmd_write (cmd_fallback.c:250)
==18022==    by 0x4E418BC: ibv_cmd_create_ah (cmd.c:1443)
==18022==    by 0x7E9E0F7: efa_create_ah (verbs.c:1180)
==18022==    by 0x4E4C120: ibv_create_ah@@IBVERBS_1.1 (verbs.c:641)
==18022==    by 0x403191: pp_connect_ctx (ud_pingpong.c:117)
==18022==    by 0x402694: main (ud_pingpong.c:741)
==18022==  Address 0x1ffefffe0c is on thread 1's stack
==18022==  in frame linux-rdma#2, created by ibv_cmd_create_ah (cmd.c:1425)

Signed-off-by: Gal Pressman <[email protected]>
  • Loading branch information
gal-pressman committed Jul 25, 2019
1 parent 2066065 commit f2f0fb2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libibverbs/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,16 +1428,19 @@ int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,

cmd.user_handle = (uintptr_t) ah;
cmd.pd_handle = pd->handle;
cmd.reserved = 0;
cmd.attr.dlid = attr->dlid;
cmd.attr.sl = attr->sl;
cmd.attr.src_path_bits = attr->src_path_bits;
cmd.attr.static_rate = attr->static_rate;
cmd.attr.is_global = attr->is_global;
cmd.attr.port_num = attr->port_num;
cmd.attr.reserved = 0;
cmd.attr.grh.flow_label = attr->grh.flow_label;
cmd.attr.grh.sgid_index = attr->grh.sgid_index;
cmd.attr.grh.hop_limit = attr->grh.hop_limit;
cmd.attr.grh.traffic_class = attr->grh.traffic_class;
cmd.attr.grh.reserved = 0;
memcpy(cmd.attr.grh.dgid, attr->grh.dgid.raw, 16);

ret = execute_cmd_write(pd->context, IB_USER_VERBS_CMD_CREATE_AH, &cmd,
Expand Down

0 comments on commit f2f0fb2

Please sign in to comment.