[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z7jX+z/Ucq5iu5bS@dev-ushankar.dev.purestorage.com>
Date: Fri, 21 Feb 2025 12:46:03 -0700
From: Uday Shankar <ushankar@...estorage.com>
To: David Laight <david.laight.linux@...il.com>
Cc: Breno Leitao <leitao@...ian.org>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Rafał Miłecki <rafal@...ecki.pl>,
Simon Horman <horms@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Johannes Berg <johannes@...solutions.net>,
Jonathan Corbet <corbet@....net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
linux-doc@...r.kernel.org,
Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
Subject: Re: [PATCH net-next v5 1/2] net, treewide: define and use
MAC_ADDR_STR_LEN
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.
Powered by blists - more mailing lists