diff options
| author | Uday Shankar <[email protected]> | 2025-03-12 19:51:46 +0000 |
|---|---|---|
| committer | Paolo Abeni <[email protected]> | 2025-03-19 18:17:58 +0000 |
| commit | 6d6c1ba7824022528dbe3e283fafbd0775424128 (patch) | |
| tree | 0887dedc1321e397e52db3e50b2079c2b6c9e75f /lib/net_utils.c | |
| parent | r8169: switch away from deprecated pcim_iomap_table (diff) | |
| download | kernel-6d6c1ba7824022528dbe3e283fafbd0775424128.tar.gz kernel-6d6c1ba7824022528dbe3e283fafbd0775424128.zip | |
net, treewide: define and use MAC_ADDR_STR_LEN
There are a few places in the tree which compute the length of the
string representation of a MAC address as 3 * ETH_ALEN - 1. Define a
constant for this and use it where relevant. No functionality changes
are expected.
Signed-off-by: Uday Shankar <[email protected]>
Reviewed-by: Michal Swiatkowski <[email protected]>
Acked-by: Johannes Berg <[email protected]>
Reviewed-by: Breno Leitao <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'lib/net_utils.c')
| -rw-r--r-- | lib/net_utils.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/net_utils.c b/lib/net_utils.c index 42bb0473fb22..215cda672fee 100644 --- a/lib/net_utils.c +++ b/lib/net_utils.c @@ -7,11 +7,9 @@ bool mac_pton(const char *s, u8 *mac) { - size_t maxlen = 3 * ETH_ALEN - 1; int i; - /* XX:XX:XX:XX:XX:XX */ - if (strnlen(s, maxlen) < maxlen) + if (strnlen(s, MAC_ADDR_STR_LEN) < MAC_ADDR_STR_LEN) return false; /* Don't dirty result unless string is valid MAC. */ |
