Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753627AbdHXQGz (ORCPT ); Thu, 24 Aug 2017 12:06:55 -0400 Received: from smtprelay0078.hostedemail.com ([216.40.44.78]:40484 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753275AbdHXQGw (ORCPT ); Thu, 24 Aug 2017 12:06:52 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:355:379:541:599:601:973:988:989:1260:1277:1311:1313:1314:1345:1358:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3027:3138:3139:3140:3141:3142:3352:3622:3636:3866:3867:3868:3869:4321:5007:8603:10004:10400:10848:11026:11658:11914:12043,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: moon43_73869f955702d X-Filterd-Recvd-Size: 1815 Message-ID: <1503590792.12569.2.camel@perches.com> Subject: Re: [PATCH] IB/core: replace memcpy with ether_addr_copy From: Joe Perches To: Himanshu Jha , dledford@redhat.com Cc: sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 24 Aug 2017 09:06:32 -0700 In-Reply-To: <1503589307-10457-1-git-send-email-himanshujha199640@gmail.com> References: <1503589307-10457-1-git-send-email-himanshujha199640@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 930 Lines: 28 On Thu, 2017-08-24 at 21:11 +0530, Himanshu Jha wrote: > Use ether_addr_copy to copy an ethernet address of size ETH_ALEN > instead of memcpy. [] diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c [] > @@ -798,7 +798,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, > if (ret) > return ret; > > - memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN); > + ether_addr_copy(dmac, dev_addr.dst_dev_addr); > dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if); > if (!dev) > return -ENODEV; > @@ -831,7 +831,7 @@ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id) > if (ret) > return ret; > > - memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN); > + ether_addr_copy(smac, dev_addr.src_dev_addr); > return ret; > } > EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid); Both dmac and smac are function arguments. What guarantees these to be aligned properly?