diff mbox

[V1,for-3.17] IB/core: When marsheling uverbs path, clear unused fields

Message ID 1409661154-13718-1-git-send-email-ogerlitz@mellanox.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Or Gerlitz Sept. 2, 2014, 12:32 p.m. UTC
From: Matan Barak <matanb@mellanox.com>

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 <alekseys@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---

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 mbox

Patch

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);