netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Randy Dunlap <rdunlap@infradead.org>,
	Kees Cook <keescook@chromium.org>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v1] net: pasemi: Replace mac address parsing
Date: Tue, 19 Dec 2017 21:27:30 +0200	[thread overview]
Message-ID: <1513711650.7000.213.camel@linux.intel.com> (raw)
In-Reply-To: <b47bd767-5476-04f6-9be0-1b780313fbfd@infradead.org>

On Tue, 2017-12-19 at 11:19 -0800, Randy Dunlap wrote:
> On 12/19/2017 10:31 AM, Andy Shevchenko wrote:
> > Replace sscanf() with mac_pton().
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> You don't need to select GENERIC_NET_UTILS for that?

It's done by CONFIG_NET.

> 
> > ---
> >  drivers/net/ethernet/pasemi/pasemi_mac.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c
> > b/drivers/net/ethernet/pasemi/pasemi_mac.c
> > index c9a55b774935..07a2eb3781b1 100644
> > --- a/drivers/net/ethernet/pasemi/pasemi_mac.c
> > +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
> > @@ -212,9 +212,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac
> > *mac)
> >  		return -ENOENT;
> >  	}
> >  
> > -	if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
> > -		   &addr[0], &addr[1], &addr[2], &addr[3],
> > &addr[4], &addr[5])
> > -	    != ETH_ALEN) {
> > +	if (!mac_pton(maddr, addr)) {
> >  		dev_warn(&pdev->dev,
> >  			 "can't parse mac address, not
> > configuring\n");
> >  		return -EINVAL;
> > 
> 
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2017-12-19 19:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19 18:31 [PATCH v1] net: pasemi: Replace mac address parsing Andy Shevchenko
2017-12-19 19:19 ` Randy Dunlap
2017-12-19 19:27   ` Andy Shevchenko [this message]
2017-12-19 19:45     ` Randy Dunlap
2017-12-20 17:48 ` David Miller

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=1513711650.7000.213.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=keescook@chromium.org \
    --cc=netdev@vger.kernel.org \
    --cc=rdunlap@infradead.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).