diff mbox

[libibverbs,7/9] ibv_cmd_create_flow(): explicitly clear fields

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

Commit Message

Yann Droneaud Oct. 1, 2014, 11:49 a.m. UTC
There's no need to clear the whole struct ibv_create_flow
+ struct ibv_kern_spec with memset().

This patch removes call to memset(), adds explicit
initialization for reserved fields, set comp_mask
explicitly

Link: http://marc.info/?i=cover.1412163687.git.ydroneaud@opteya.com
Fixes: 389de6a6ef4e ('Add receive flow steering support')
Cc: Hadar Hen Zion <hadarh@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Matan Barak <matanb@mellanox.com>
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
---
 src/cmd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/src/cmd.c b/src/cmd.c
index f9e4a03fd84d..dc155d6bf4c7 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1289,6 +1289,7 @@  static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 				struct ibv_kern_spec *kern_spec)
 {
 	kern_spec->hdr.type = ib_spec->hdr.type;
+	kern_spec->hdr.reserved = 0;
 
 	switch (ib_spec->hdr.type) {
 	case IBV_FLOW_SPEC_ETH:
@@ -1337,15 +1338,17 @@  struct ibv_flow *ibv_cmd_create_flow(struct ibv_qp *qp,
 	flow_id = malloc(sizeof(*flow_id));
 	if (!flow_id)
 		return NULL;
-	memset(cmd, 0, cmd_size);
 
+	cmd->comp_mask = 0;
 	cmd->qp_handle = qp->handle;
 
+	cmd->flow_attr.size = 0;
 	cmd->flow_attr.type = flow_attr->type;
 	cmd->flow_attr.priority = flow_attr->priority;
 	cmd->flow_attr.num_of_specs = flow_attr->num_of_specs;
 	cmd->flow_attr.port = flow_attr->port;
 	cmd->flow_attr.flags = flow_attr->flags;
+	cmd->flow_attr.reserved[0] = cmd->flow_attr.reserved[1] = 1;
 
 	kern_spec = cmd + 1;
 	ib_spec = flow_attr + 1;