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

From: Vladimir Oltean
Date: Tue Oct 10 2023 - 18:14:01 EST


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, indices[i], false);
> ethtool_sprintf(&buf, "%s", cnt ? cnt->name : "");
> }

Looks like that would address my comment, and it looks okay.