net: bonding: Replace mac address parsing
Subsystems (3)
PATCH 1/1 net: bonding: Replace mac address parsing
Replace sscanf() with mac_pton().
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/net/bonding/bond_options.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/bonding/bond_options.c +1 -5
@@ -1431,13 +1431,9 @@ static int bond_option_ad_actor_system_set(struct bonding *bond, {u8 macaddr[ETH_ALEN ];u8 *mac; -int i;if (newval->string) { - i =sscanf (newval->string,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx" , - &macaddr[0 ], &macaddr[1 ], &macaddr[2 ], - &macaddr[3 ], &macaddr[4 ], &macaddr[5 ]); -if (i !=ETH_ALEN ) +if (!mac_pton (newval->string, macaddr)) goto err; mac = macaddr; }else {
Signature · 1 line
2.15.1
Quoted 3 lines · Andy Shevchenko
Replace
sscanf()withmac_pton().Signed-off-by Andy Shevchenko <[email protected]>
Nice cleanup. Thanks!
Acked-by Andy Gospodarek <[email protected]>
Quoted 26 lines
--- drivers/net/bonding/bond_options.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)drivers/net/bonding/bond_options.c +1
-5@@ -1431,13 +1431,9 @@ static int bond_option_ad_actor_system_set(struct bonding *bond, {u8 macaddr[ETH_ALEN ];u8 *mac; -int i;if (newval->string) { - i =sscanf (newval->string,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx" , - &macaddr[0 ], &macaddr[1 ], &macaddr[2 ], - &macaddr[3 ], &macaddr[4 ], &macaddr[5 ]); -if (i !=ETH_ALEN ) +if (!mac_pton (newval->string, macaddr)) goto err; mac = macaddr; }else {Signature · 1 line
2.15.1
From: Andy Shevchenko <[email protected]>
Date: Tue, 19 Dec 2017 20:20:44 +0200
Quoted 3 lines
Replace
sscanf()withmac_pton().Signed-off-by Andy Shevchenko <[email protected]>
Applied to net-next.