Re: [PATCH v3 2/2] net: macb: use ethtool_sprintf to fill ethtool stats strings

From: Andrew Lunn

Date: Tue Feb 24 2026 - 13:00:21 EST


On Wed, Feb 25, 2026 at 12:54:35AM +0800, Sean Chang wrote:
> The RISC-V toolchain triggers a stringop-truncation warning when using
> snprintf() with a fixed ETH_GSTRING_LEN (32 bytes) buffer.
>
> Convert the driver to use the modern ethtool_sprintf() API from
> linux/ethtool.h. This removes the need for manual snprintf() and
> memcpy() calls, handles the 32-byte padding automatically, and
> simplifies the logic by removing manual pointer arithmetic.
>
> Signed-off-by: Sean Chang <seanwascoding@xxxxxxxxx>

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Andrew