Thread View: org.infradead.lists.linux-um
1 messages
1 total messages
Started by Tiwei Bie
Tue, 06 May 2025 04:51
[PATCH 2/2] um: vector: Use mac_pton() for MAC address parsing
Author: Tiwei Bie
Date: Tue, 06 May 2025 04:51
Date: Tue, 06 May 2025 04:51
41 lines
5215 bytes
5215 bytes
Use mac_pton() instead of custom approach.
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/drivers/vector_kern.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index 7822421057ea..5226d2c52e6a 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,
--
2.34.1
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads