Skip to content

Commit b76d18b

Browse files
btw616jmberg-intel
authored andcommitted
um: vector: Use mac_pton() for MAC address parsing
Use mac_pton() instead of custom approach. Suggested-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Tiwei Bie <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 477c1c2 commit b76d18b

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

arch/um/drivers/vector_kern.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,21 +1543,14 @@ static void vector_timer_expire(struct timer_list *t)
15431543
static void vector_setup_etheraddr(struct net_device *dev, char *str)
15441544
{
15451545
u8 addr[ETH_ALEN];
1546-
char *end;
1547-
int i;
15481546

15491547
if (str == NULL)
15501548
goto random;
15511549

1552-
for (i = 0; i < 6; i++) {
1553-
addr[i] = simple_strtoul(str, &end, 16);
1554-
if ((end == str) ||
1555-
((*end != ':') && (*end != ',') && (*end != '\0'))) {
1556-
netdev_err(dev,
1557-
"Failed to parse '%s' as an ethernet address\n", str);
1558-
goto random;
1559-
}
1560-
str = end + 1;
1550+
if (!mac_pton(str, addr)) {
1551+
netdev_err(dev,
1552+
"Failed to parse '%s' as an ethernet address\n", str);
1553+
goto random;
15611554
}
15621555
if (is_multicast_ether_addr(addr)) {
15631556
netdev_err(dev,

0 commit comments

Comments
 (0)