From patchwork Tue Sep 2 12:32:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Or Gerlitz X-Patchwork-Id: 4824911 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 EDC4CC0338 for ; Tue, 2 Sep 2014 12:32:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C15322017E for ; Tue, 2 Sep 2014 12:32:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BBE12016C for ; Tue, 2 Sep 2014 12:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753540AbaIBMck (ORCPT ); Tue, 2 Sep 2014 08:32:40 -0400 Received: from mailp.voltaire.com ([193.47.165.129]:45006 "EHLO mellanox.co.il" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753452AbaIBMck (ORCPT ); Tue, 2 Sep 2014 08:32:40 -0400 Received: from Internal Mail-Server by MTLPINE2 (envelope-from ogerlitz@mellanox.com) with SMTP; 2 Sep 2014 15:32:37 +0300 Received: from r-vnc04.mtr.labs.mlnx (r-vnc04.mtr.labs.mlnx [10.208.0.116]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id s82CWaAJ031850; Tue, 2 Sep 2014 15:32:36 +0300 From: Or Gerlitz To: roland@kernel.org Cc: linux-rdma@vger.kernel.org, Matan Barak , Or Gerlitz Subject: [PATCH V1 for-3.17] IB/core: When marsheling uverbs path, clear unused fields Date: Tue, 2 Sep 2014 15:32:34 +0300 Message-Id: <1409661154-13718-1-git-send-email-ogerlitz@mellanox.com> X-Mailer: git-send-email 1.7.8.2 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.6 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 From: Matan Barak When marsheling a user path to the kernel struct ib_sa_path, need to zero smac, dmac and set the vlan id to the "no vlan" value. Fixes: dd5f03b ('IB/core: Ethernet L2 attributes in verbs/cm structures') Reported-by: Aleksey Senin Signed-off-by: Matan Barak Signed-off-by: Or Gerlitz --- Roland, Please apply this patch instead of https://patchwork.kernel.org/patch/4756711/ "[PATCH for-3.17,7/7] IB/core: When marsheling uverbs path, clear unused fields changes from V0: addressed sparse complaints on casting to __be16 drivers/infiniband/core/uverbs_marshall.c:146:24: warning: cast to restricted __be16 We can simply use the non be16 0xffff value which signals "no vlan" Or. drivers/infiniband/core/uverbs_marshall.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/infiniband/core/uverbs_marshall.c b/drivers/infiniband/core/uverbs_marshall.c index e7bee46..abd9724 100644 --- a/drivers/infiniband/core/uverbs_marshall.c +++ b/drivers/infiniband/core/uverbs_marshall.c @@ -140,5 +140,9 @@ void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst, dst->packet_life_time = src->packet_life_time; dst->preference = src->preference; dst->packet_life_time_selector = src->packet_life_time_selector; + + memset(dst->smac, 0, sizeof(dst->smac)); + memset(dst->dmac, 0, sizeof(dst->dmac)); + dst->vlan_id = 0xffff; } EXPORT_SYMBOL(ib_copy_path_rec_from_user);