um: vector: Use mac_pton() for MAC address parsing

Use mac_pton() instead of custom approach.

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
Link: https://patch.msgid.link/20250506045117.1896661-3-tiwei.btw@antgroup.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
pull/1256/merge
Tiwei Bie 2025-05-06 12:51:17 +08:00 committed by Johannes Berg
parent 477c1c21da
commit b76d18b53a
1 changed files with 4 additions and 11 deletions

View File

@ -1543,21 +1543,14 @@ static void vector_timer_expire(struct timer_list *t)
static void vector_setup_etheraddr(struct net_device *dev, char *str)
{
u8 addr[ETH_ALEN];
char *end;
int i;
if (str == NULL)
goto random;
for (i = 0; i < 6; i++) {
addr[i] = simple_strtoul(str, &end, 16);
if ((end == str) ||
((*end != ':') && (*end != ',') && (*end != '\0'))) {
netdev_err(dev,
"Failed to parse '%s' as an ethernet address\n", str);
goto random;
}
str = end + 1;
if (!mac_pton(str, addr)) {
netdev_err(dev,
"Failed to parse '%s' as an ethernet address\n", str);
goto random;
}
if (is_multicast_ether_addr(addr)) {
netdev_err(dev,