From patchwork Wed Oct 1 11:49:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Droneaud X-Patchwork-Id: 5011441 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EEFE1BEEA6 for ; Wed, 1 Oct 2014 11:57:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2683320155 for ; Wed, 1 Oct 2014 11:57:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE1DD2014A for ; Wed, 1 Oct 2014 11:57:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751337AbaJAL5A (ORCPT ); Wed, 1 Oct 2014 07:57:00 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:51664 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751146AbaJAL47 (ORCPT ); Wed, 1 Oct 2014 07:56:59 -0400 Received: from localhost.localdomain (unknown [37.163.159.60]) by smtp3-g21.free.fr (Postfix) with ESMTP id 03B9FA623A; Wed, 1 Oct 2014 13:56:23 +0200 (CEST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.8/8.14.8) with ESMTP id s91Bshat013350; Wed, 1 Oct 2014 13:56:23 +0200 Received: (from ydroneaud@localhost) by localhost.localdomain (8.14.8/8.14.8/Submit) id s91Bow4c013039; Wed, 1 Oct 2014 13:50:58 +0200 From: Yann Droneaud To: Roland Dreier Cc: linux-rdma@vger.kernel.org, Dotan Barak , Yann Droneaud , Hadar Hen Zion , Or Gerlitz , Matan Barak Subject: [PATCH libibverbs 7/9] ibv_cmd_create_flow(): explicitly clear fields Date: Wed, 1 Oct 2014 13:49:37 +0200 Message-Id: <8b641d9acad075b54092dc7a44ff987ec49fc9b5.1412163687.git.ydroneaud@opteya.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Or Gerlitz Cc: Matan Barak Signed-off-by: Yann Droneaud --- src/cmd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;