From patchwork Thu Jan 29 18:00:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Droneaud X-Patchwork-Id: 5744341 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2BCD5BF6C3 for ; Thu, 29 Jan 2015 18:02:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D88E2024F for ; Thu, 29 Jan 2015 18:02:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 962B020142 for ; Thu, 29 Jan 2015 18:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754339AbbA2SCL (ORCPT ); Thu, 29 Jan 2015 13:02:11 -0500 Received: from smtpfb2-g21.free.fr ([212.27.42.10]:40550 "EHLO smtpfb2-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752297AbbA2SCH (ORCPT ); Thu, 29 Jan 2015 13:02:07 -0500 Received: from smtp4-g21.free.fr (smtp4-g21.free.fr [212.27.42.4]) by smtpfb2-g21.free.fr (Postfix) with ESMTP id D75E7CA9E45; Thu, 29 Jan 2015 19:02:03 +0100 (CET) Received: from localhost.localdomain (unknown [37.161.184.214]) by smtp4-g21.free.fr (Postfix) with ESMTP id 490B34C8081; Thu, 29 Jan 2015 18:59:31 +0100 (CET) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.9/8.14.8) with ESMTP id t0TI1s11026348; Thu, 29 Jan 2015 19:01:54 +0100 Received: (from ydroneaud@localhost) by localhost.localdomain (8.14.9/8.14.9/Submit) id t0TI1s8W026347; Thu, 29 Jan 2015 19:01:54 +0100 From: Yann Droneaud To: Sagi Grimberg , Shachar Raindel , Eli Cohen , Haggai Eran , Roland Dreier Cc: Yann Droneaud , linux-rdma@vger.kernel.org, linux-api@vger.kernel.org Subject: [PATCH v1 4/5] IB/uverbs: ex_query_device: no need to clear the whole structure Date: Thu, 29 Jan 2015 19:00:01 +0100 Message-Id: <0b646f62e9272bc962a1ff6ff03ad9523b454dfe.1422553023.git.ydroneaud@opteya.com> X-Mailer: git-send-email 2.1.0 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 As only the requested fields are set and copied to userspace, there's no need to clear the content of the response structure beforehand. Link: http://mid.gmane.org/cover.1422553023.git.ydroneaud@opteya.com Cc: Sagi Grimberg Cc: Shachar Raindel Cc: Eli Cohen Cc: Haggai Eran Signed-off-by: Yann Droneaud Reviewed-By: Jason Gunthorpe Reviewed-by: Haggai Eran --- drivers/infiniband/core/uverbs_cmd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 81d8b5aa2eb6..9520880a163f 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -3328,9 +3328,9 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file, if (err) return err; - memset(&resp, 0, sizeof(resp)); copy_query_dev_fields(file, &resp.base, &attr); resp.comp_mask = 0; + resp.reserved = 0; if (ucore->outlen < resp_len + sizeof(resp.odp_caps)) goto end; @@ -3343,6 +3343,9 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file, attr.odp_caps.per_transport_caps.uc_odp_caps; resp.odp_caps.per_transport_caps.ud_odp_caps = attr.odp_caps.per_transport_caps.ud_odp_caps; + resp.odp_caps.reserved = 0; +#else + memset(&resp.odp_caps, 0, sizeof(resp.odp_caps)); #endif resp.comp_mask |= IB_USER_VERBS_EX_QUERY_DEVICE_ODP; resp_len += sizeof(resp.odp_caps);