[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230718124156.07632716@kernel.org>
Date: Tue, 18 Jul 2023 12:41:56 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Andrew Lunn <andrew@...n.ch>
Cc: Kees Cook <kees@...nel.org>, justinstitt@...gle.com, Florian Fainelli
<f.fainelli@...il.com>, Vladimir Oltean <olteanv@...il.com>, "David S.
Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo
Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>, Nick
Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH] net: dsa: remove deprecated strncpy
On Tue, 18 Jul 2023 21:31:04 +0200 Andrew Lunn wrote:
> On Tue, Jul 18, 2023 at 12:11:16PM -0700, Jakub Kicinski wrote:
> > On Tue, 18 Jul 2023 11:05:23 -0700 Kees Cook wrote:
> > > Honestly I find the entire get_strings API to be very fragile given
> > > the lack of passing the length of the buffer, instead depending on
> > > the string set length lookups in each callback, but refactoring that
> > > looks like a ton of work for an uncertain benefit.
> >
> > We have been adding better APIs for long term, and a print helper short
> > term - ethtool_sprintf(). Should we use ethtool_sprintf() here?
>
> I was wondering about that as well. There is no variable expansion in
> most cases, so the vsnprintf() is a waste of time.
>
> Maybe we should actually add another helper:
>
> ethtool_name_cpy(u8 **data, unsigned int index, const char *name);
I wasn't sure if vsnprintf() is costly enough to bother, but SG.
Probably without the "unsigned int index", since the ethtool_sprintf()
API updates the first argument for the caller.
> Then over the next decade, slowly convert all drivers to it. And then
> eventually replace the u8 with a struct including the length.
>
> The netlink API is a bit better. It is one kAPI call which does
> everything, and it holds RTNL. So it is less likely the number of
> statistics will change between the calls into the driver.
Powered by blists - more mailing lists