Re: [PATCH] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Tue, Oct 10, 2023 at 10:44:42AM -0700, Justin Stitt wrote: > Wow, thanks for the feedback here. I agree that the current > proposal is problematic. I wonder what you think about > using a ternary to avoid smelly code dupe: > > for (i = 0; i < 3; i++) { > cnt = vsc73xx_find_counter(vsc,

Re: [PATCH] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Tue, Oct 10, 2023 at 02:49:26PM -0700, Justin Stitt wrote: > On Tue, Oct 10, 2023 at 4:20 AM Vladimir Oltean wrote: > > Here you don't use "%s", but everywhere else you do. Can't you just pass > > the counter name everywhere, without "%s"? > &

Re: [PATCH] net: dsa: realtek: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
> > --- > base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 > change-id: > 20231009-strncpy-drivers-net-dsa-realtek-rtl8366-core-c-60a0f0ddc5cc > > Best regards, > -- > Justin Stitt > Reviewed-by: Vladimir Oltean

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
anual-4.8/strscpy.9.en.html > [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt > --- Reviewed-by: Vladimir Oltean

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Tue, Oct 10, 2023 at 02:48:07PM -0700, Justin Stitt wrote: > On Tue, Oct 10, 2023 at 10:36 AM Justin Stitt wrote: > > > Is there any particular reason why you opted for the "%s" printf format > > > specifier when you could have simply given mib->name as the single > > > argument? This comment a

Re: [PATCH] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Mon, Oct 09, 2023 at 10:54:37PM +, 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: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
Hello Justin, On Mon, Oct 09, 2023 at 10:43:59PM +, 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