lkml.org 
[lkml]   [2012]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 05/12] team: check given MAC address, if invalid return -EADDRNOTAVAIL
Fri, Feb 24, 2012 at 05:01:15PM CET, danny.kukawka@bisect.de wrote:
>Check if given address is valid in .ndo_set_mac_address, if
>invalid return -EADDRNOTAVAIL as eth_mac_addr() already does
>if is_valid_ether_addr() fails.
>
>Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
>---
> drivers/net/team/team.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index 8f81805..788650c 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -868,6 +868,9 @@ static int team_set_mac_address(struct net_device *dev, void *p)
> struct team_port *port;
> struct sockaddr *addr = p;
>
>+ if (!is_valid_ether_addr(addr->sa_data))
>+ return -EADDRNOTAVAIL;
>+


Wouldn't it be better to do this in one place? dev_set_mac_address()
seems like a good place...

Jirka


> dev->addr_assign_type &= ~NET_ADDR_RANDOM;
> memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
> rcu_read_lock();
>--
>1.7.8.3
>


\
 
 \ /
  Last update: 2012-02-26 01:09    [from the cache]
©2003-2011 Jasper Spaans