diff mbox

[libibverbs,1/9] ibv_cmd_create_ah(): initialize reserved fields in various structures

Message ID 7989836f5db0c7e8199c80ce7f6851daf7a0a6dc.1412163687.git.ydroneaud@opteya.com (mailing list archive)
State Rejected
Headers show

Commit Message

Yann Droneaud Oct. 1, 2014, 11:49 a.m. UTC
Reserved fields in struct ibv_kern_global_route,
struct ibv_kern_ah_attr and struct ibv_create_ah must be
properly initialized when exchanged with kernel uverbs layer,
as:
- it may remove valgrind spurious warnings;
- it 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 | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/src/cmd.c b/src/cmd.c
index 45ea06ff4705..b281082f2f4d 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1179,16 +1179,19 @@  int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_AH, &resp, sizeof resp);
 	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);
 
 	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)