Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-25 Thread Justin Stitt
On Sat, Oct 14, 2023 at 7:36 PM Kees Cook wrote: > > On Sat, Oct 14, 2023 at 03:55:41AM +0200, Andrew Lunn wrote: > > > I've been told that this whole ethtool API area is considered > > > deprecated. If that holds, then I don't think it's worth adding new > > > helpers to support it when ethtool_s

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-14 Thread Kees Cook
On Sat, Oct 14, 2023 at 03:55:41AM +0200, Andrew Lunn wrote: > > I've been told that this whole ethtool API area is considered > > deprecated. If that holds, then I don't think it's worth adding new > > helpers to support it when ethtool_sprintf() is sufficient. > > I think deprecated is too stron

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-13 Thread Andrew Lunn
> I've been told that this whole ethtool API area is considered > deprecated. If that holds, then I don't think it's worth adding new > helpers to support it when ethtool_sprintf() is sufficient. I think deprecated is too strong. The current API is not great, so maybe with time a new API will emer

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-13 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Thu, 12 Oct 2023 22:25:12 + you wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > ethtool

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-13 Thread Kees Cook
On Thu, Oct 12, 2023 at 10:25:12PM +, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > ethtool_sprintf() is designed specifically for get_strings() usage. > Let

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-13 Thread Kees Cook
On Fri, Oct 13, 2023 at 02:23:34PM -0700, Justin Stitt wrote: > On Fri, Oct 13, 2023 at 2:12 PM Justin Stitt wrote: > > > > On Fri, Oct 13, 2023 at 1:13 PM Andrew Lunn wrote: > > > > > > On Fri, Oct 13, 2023 at 12:53:53PM -0700, Justin Stitt wrote: > > > > On Fri, Oct 13, 2023 at 5:22 AM Andrew L

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-13 Thread Justin Stitt
On Fri, Oct 13, 2023 at 2:12 PM Justin Stitt wrote: > > On Fri, Oct 13, 2023 at 1:13 PM Andrew Lunn wrote: > > > > On Fri, Oct 13, 2023 at 12:53:53PM -0700, Justin Stitt wrote: > > > On Fri, Oct 13, 2023 at 5:22 AM Andrew Lunn wrote: > > > > > > > > > - for (i = 0; i < ARRAY_SIZE(tja11xx_hw_

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-13 Thread Justin Stitt
On Fri, Oct 13, 2023 at 1:13 PM Andrew Lunn wrote: > > On Fri, Oct 13, 2023 at 12:53:53PM -0700, Justin Stitt wrote: > > On Fri, Oct 13, 2023 at 5:22 AM Andrew Lunn wrote: > > > > > > > - for (i = 0; i < ARRAY_SIZE(tja11xx_hw_stats); i++) { > > > > - strncpy(data + i * ETH_GSTRING

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-13 Thread Andrew Lunn
On Fri, Oct 13, 2023 at 12:53:53PM -0700, Justin Stitt wrote: > On Fri, Oct 13, 2023 at 5:22 AM Andrew Lunn wrote: > > > > > - for (i = 0; i < ARRAY_SIZE(tja11xx_hw_stats); i++) { > > > - strncpy(data + i * ETH_GSTRING_LEN, > > > - tja11xx_hw_stats[i].string, ET

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-13 Thread Justin Stitt
On Fri, Oct 13, 2023 at 5:22 AM Andrew Lunn wrote: > > > - for (i = 0; i < ARRAY_SIZE(tja11xx_hw_stats); i++) { > > - strncpy(data + i * ETH_GSTRING_LEN, > > - tja11xx_hw_stats[i].string, ETH_GSTRING_LEN); > > - } > > + for (i = 0; i < ARRAY_SIZE(tja11xx

Re: [PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-13 Thread Andrew Lunn
> - for (i = 0; i < ARRAY_SIZE(tja11xx_hw_stats); i++) { > - strncpy(data + i * ETH_GSTRING_LEN, > - tja11xx_hw_stats[i].string, ETH_GSTRING_LEN); > - } > + for (i = 0; i < ARRAY_SIZE(tja11xx_hw_stats); i++) > + ethtool_sprintf(&data, "%s", tj

[PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-12 Thread Justin Stitt
strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. ethtool_sprintf() is designed specifically for get_strings() usage. Let's replace strncpy in favor of this dedicated helper function. Link: htt