From 143c017108f8a695e4e1c1f5ec57ee89be9cad70 Mon Sep 17 00:00:00 2001 From: Ursula Braun Date: Thu, 12 Jan 2017 14:57:15 +0100 Subject: smc: ETH_ALEN as memcpy length for mac addresses When creating an SMC connection, there is a CLC (connection layer control) handshake to prepare for RDMA traffic. The corresponding code is part of commit 0cfdd8f92cac ("smc: connection and link group creation"). Mac addresses to be exchanged in the handshake are copied with a wrong length of 12 instead of 6 bytes. Following code overwrites the wrongly copied code, but nevertheless the correct length should already be used for the preceding mac address copying. Use ETH_ALEN for the memcpy length with mac addresses. Signed-off-by: Ursula Braun Fixes: 0cfdd8f92cac ("smc: connection and link group creation") Reported-by: Dan Carpenter Signed-off-by: David S. Miller --- net/smc/smc_ib.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'net/smc/smc_ib.h') diff --git a/net/smc/smc_ib.h b/net/smc/smc_ib.h index 3fe2d55c6051..a95f74bb5569 100644 --- a/net/smc/smc_ib.h +++ b/net/smc/smc_ib.h @@ -11,6 +11,7 @@ #ifndef _SMC_IB_H #define _SMC_IB_H +#include #include #define SMC_MAX_PORTS 2 /* Max # of ports */ @@ -34,7 +35,8 @@ struct smc_ib_device { /* ib-device infos for smc */ struct ib_cq *roce_cq_recv; /* recv completion queue */ struct tasklet_struct send_tasklet; /* called by send cq handler */ struct tasklet_struct recv_tasklet; /* called by recv cq handler */ - char mac[SMC_MAX_PORTS][6]; /* mac address per port*/ + char mac[SMC_MAX_PORTS][ETH_ALEN]; + /* mac address per port*/ union ib_gid gid[SMC_MAX_PORTS]; /* gid per port */ u8 initialized : 1; /* ib dev CQ, evthdl done */ struct work_struct port_event_work; -- cgit