Re: [PATCH v2 2/2] net: macb: fix format-truncation warning

From: Andrew Lunn

Date: Tue Feb 17 2026 - 15:35:37 EST


On Wed, Feb 18, 2026 at 03:14:08AM +0800, Sean Chang wrote:
> On Wed, Feb 18, 2026 at 1:46 AM Andrew Lunn <andrew@xxxxxxx> wrote:
> >
> > Given the other patches in there series, i have to wounder, is the
> > diagnostic analysis correct? Or is the RISC-V toolchain buggy?
> >
>
> I retry the different methods, I found that when I directly compile
> the macb_main.c, it can trigger the same error, and I already prove
> the different compiler will reach the same result, so it is not a bug
> of the compiler.
>
> I also found that the x86_64 defconfig does not enable CONFIG_MACB
> because it requires CONFIG_COMMON_CLK (which is also disabled by
> default on x86), whereas the RISC-V defconfig has both enabled.

arm and arm64 are much more similar to risc-v than x86. You should
test with those compilers. However, make allmodconfig will get you the
common clk code on x86. Most build testing is done with this
configuration, including the netdev CI.

> > I do agree ethtool_sprintf() is better. But we want the commit message
> > to reflect why we are making this change. Is it because
> > ethtool_sprintf() is better, or are we working around toolchain bugs?
> >
>
> according to the content I mentioned upon, I think the commit will
> something like "ethtool_sprintf() is better to prevent data truncation
> and properly fill the 32-byte ethtool string boundary.'"

O.K.

Andrew