diff options
author | Tiwei Bie <tiwei.btw@antgroup.com> | 2025-05-06 12:51:17 +0800 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2025-06-02 11:24:04 +0200 |
commit | b76d18b53a3f52880452a58cc982910abcccd111 (patch) | |
tree | d5e626a52181ca576f6edb11e62743eee47371a3 | |
parent | 477c1c21da0d6ffc4dfe924178b90377f2938ba5 (diff) |
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>
-rw-r--r-- | arch/um/drivers/vector_kern.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index 7822421057ea7..5226d2c52e6ab 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -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, |