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

- From: Andrew Lunn \<andrew@lunn.ch\>
- Date: 2026-02-24 17:55:55 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/02/3425365
- Thread: https://ratatoskr.run/netdev/2026/02/3425264/t.md

```text
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 <redacted>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
```
