From: "Tiwei Bie" <tiwei.btw@antgroup.com>
To: richard@nod.at, anton.ivanov@cambridgegreys.com,
johannes@sipsolutions.net
Cc: <linux-um@lists.infradead.org>, <geert@linux-m68k.org>,
"Tiwei Bie" <tiwei.btw@antgroup.com>
Subject: [PATCH 2/2] um: vector: Use mac_pton() for MAC address parsing
Date: Tue, 06 May 2025 12:51:17 +0800 [thread overview]
Message-ID: <20250506045117.1896661-3-tiwei.btw@antgroup.com> (raw)
In-Reply-To: <20250506045117.1896661-1-tiwei.btw@antgroup.com>
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
prev parent reply other threads:[~2025-05-06 6:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 4:51 [PATCH 0/2] um: Misc cleanups for vector Tiwei Bie
2025-05-06 4:51 ` [PATCH 1/2] um: vector: Clean up and modernize log messages Tiwei Bie
2025-05-06 4:51 ` Tiwei Bie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250506045117.1896661-3-tiwei.btw@antgroup.com \
--to=tiwei.btw@antgroup.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=geert@linux-m68k.org \
--cc=johannes@sipsolutions.net \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).