net: bonding: Replace mac address parsing
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 19 Dec 2017 18:20:44 +0000 (20:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Dec 2017 17:47:29 +0000 (12:47 -0500)
Replace sscanf() with mac_pton().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_options.c

index 8a9b085c2a98341e9d4b829ef4cb42daea5ae36c..58c705f24f963f98a4fa9181f18ac04f4af1d616 100644 (file)
@@ -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 {