netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] net: pasemi: Replace mac address parsing
@ 2017-12-19 18:31 Andy Shevchenko
  2017-12-19 19:19 ` Randy Dunlap
  2017-12-20 17:48 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2017-12-19 18:31 UTC (permalink / raw)
  To: Kees Cook, Eric Dumazet, David S. Miller, netdev; +Cc: Andy Shevchenko

Replace sscanf() with mac_pton().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 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;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] net: pasemi: Replace mac address parsing
  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
  2017-12-20 17:48 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2017-12-19 19:19 UTC (permalink / raw)
  To: Andy Shevchenko, Kees Cook, Eric Dumazet, David S. Miller, netdev

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?

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


-- 
~Randy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] net: pasemi: Replace mac address parsing
  2017-12-19 19:19 ` Randy Dunlap
@ 2017-12-19 19:27   ` Andy Shevchenko
  2017-12-19 19:45     ` Randy Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2017-12-19 19:27 UTC (permalink / raw)
  To: Randy Dunlap, Kees Cook, Eric Dumazet, David S. Miller, netdev

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] net: pasemi: Replace mac address parsing
  2017-12-19 19:27   ` Andy Shevchenko
@ 2017-12-19 19:45     ` Randy Dunlap
  0 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2017-12-19 19:45 UTC (permalink / raw)
  To: Andy Shevchenko, Kees Cook, Eric Dumazet, David S. Miller, netdev

On 12/19/2017 11:27 AM, Andy Shevchenko wrote:
> 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.
> 

Ah, thanks.

-- 
~Randy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] net: pasemi: Replace mac address parsing
  2017-12-19 18:31 [PATCH v1] net: pasemi: Replace mac address parsing Andy Shevchenko
  2017-12-19 19:19 ` Randy Dunlap
@ 2017-12-20 17:48 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2017-12-20 17:48 UTC (permalink / raw)
  To: andriy.shevchenko; +Cc: keescook, edumazet, netdev

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Tue, 19 Dec 2017 20:31:03 +0200

> Replace sscanf() with mac_pton().
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to net-next.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-20 17:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2017-12-19 19:45     ` Randy Dunlap
2017-12-20 17:48 ` David Miller

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