Re: [PATCH net-next v5 1/2] net, treewide: define and use MAC_ADDR_STR_LEN

From
Uday Shankar <hidden>
Date
2025-02-21 19:46:04
Also in
linux-doc, linux-wireless, lkml
Reply to
David Laight, 2025-02-21
On Fri, Feb 21, 2025 at 01:17:50PM +0000, David Laight wrote:
The fact that you have to keep adding 1 or 2 is a good indication that
it really isn't a good idea.
Having to adjust by 1 when converting between string lengths and buffer
sizes is super standard in C since strings are NUL-terminated. There are
tons of preexisting examples in the tree.

I agree that the + 2 is a bit of an eyesore but its needed in that case
because that code wants to tack on a newline in addition to a
NUL-terminator. Maybe adding a comment there would help?

In any case, MAC_ADDR_STR_LEN is a much more descriptive name for what
all the changed code is actually doing compared against 3 * ETH_ALEN -
1.
Thread (12 messages) 12 messages, 5 authors, last reply 2025-03-17
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help