netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg <gvrose8192@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, Greg Rose <grose@lightfleet.com>
Subject: Re: [PATCH] net/ethernet: Use ether_addr_copy rather than memcpy
Date: Wed, 31 Aug 2016 11:34:26 -0700	[thread overview]
Message-ID: <1472668466.3889.3.camel@gmail.com> (raw)
In-Reply-To: <1472668368.14381.358.camel@edumazet-glaptop3.roam.corp.google.com>

On Wed, 2016-08-31 at 11:32 -0700, Eric Dumazet wrote:
> On Wed, 2016-08-31 at 09:32 -0700, Greg Rose wrote:
> > I'm not sure why this hasn't been done before because it seems obvious,
> > so maybe there is some reason that memcpy is used instead of
> > ether_addr_copy in this code.  But let's try this anyway.
> > 
> > Change memcpy to ether_addr_copy.
> 
> ...
> 
> >  
> > @@ -211,7 +211,7 @@ EXPORT_SYMBOL(eth_type_trans);
> >  int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr)
> >  {
> >  	const struct ethhdr *eth = eth_hdr(skb);
> > -	memcpy(haddr, eth->h_source, ETH_ALEN);
> > +	ether_addr_copy(haddr, eth->h_source);
> 
> 
> Please carefully read ether_addr_copy() comments.
> 
> Not all arches are like x86

Thanks Eric, Joe set me straight already.

- Greg
> 
> 
> 

      reply	other threads:[~2016-08-31 18:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 16:32 [PATCH] net/ethernet: Use ether_addr_copy rather than memcpy Greg Rose
2016-08-31 16:41 ` Joe Perches
2016-08-31 16:42   ` Greg
2016-08-31 18:32 ` Eric Dumazet
2016-08-31 18:34   ` Greg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472668466.3889.3.camel@gmail.com \
    --to=gvrose8192@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=grose@lightfleet.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).