Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 2 (1) If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The patch leaves the same construct unfixed in the sibling cxgb4vf driver. - [Low] The commit message misdescribes what the change does. - [Low] The continuation lines of the call are left inconsistently aligned. Pre-existing issues: - [Low] This problem wasn't introduced by this patch, but get_drvinfo() in drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c can still format… -- cxgb4: use scnprintf() for fw_version This commit changes get_drvinfo() in cxgb4 to format info->fw_version with scnprintf() instead of snprintf(). The goal is to silence a -Wformat-truncation error that the kernel test robot reported for W=1 builds with CONFIG_WERROR. Link: https://lore.kernel.org/oe-kbuild-all/2026…@intel.com/
> Use scnprintf(), which returns the number of bytes written, so the string > is bounded by the field and the intent is visible at the call site.
[Severity: Low] Is this description accurate? snprintf() already limited the string to size - 1 bytes plus a NUL. scnprintf() writes exactly the same bytes and differs only in its return value, which get_drvinfo() discards. The warning seems to go away only because GCC's format-truncation analysis covers the snprintf()/vsnprintf() built-ins. scnprintf() is a plain kernel function declared with __printf(3, 4) in include/linux/sprintf.h, so GCC doesn't check it. The diagnostic was a true positive, since 35 characters can exceed the 31 usable bytes. Could the changelog say that the warning is being suppressed, and that the ", TP ..." suffix can still be truncated?
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c > index c72c0bcd45c80..7c88bc8102d7d 100644 > --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c > +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c > @@ -205,8 +205,8 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) > info->regdump_len = get_regs_len(dev); > > if (adapter->params.fw_vers) > - snprintf(info->fw_version, sizeof(info->fw_version), > - "%u.%u.%u.%u, TP %u.%u.%u.%u", > + scnprintf(info->fw_version, sizeof(info->fw_version), > + "%u.%u.%u.%u, TP %u.%u.%u.%u",
[Severity: Medium] Does the same build failure still happen in the sibling cxgb4vf driver? cxgb4vf_get_drvinfo() in drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c still has the same construct: snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%u.%u.%u.%u, TP %u.%u.%u.%u", FW_HDR_FW_VER_MAJOR_G(adapter->params.dev.fwrev), FW_HDR_FW_VER_MINOR_G(adapter->params.dev.fwrev), FW_HDR_FW_VER_MICRO_G(adapter->params.dev.fwrev), ... It uses the same FW_HDR_FW_VER_*_G() accessors from cxgb4/t4fw_api.h, whose masks are all 0xff. It also writes into the same 32-byte fw_version field, so GCC should compute the same 35-character worst case. scripts/Makefile.warn adds -Wno-format-truncation only outside of W=1. A W=1 build with CONFIG_WERROR (or W=e) and CONFIG_CHELSIO_T4VF enabled, such as allmodconfig, would therefore still fail. The commit message describes this build failure as resolved. Should cxgb4vf be handled in the same patch? [Severity: Low] This isn't a bug introduced by this patch, but get_drvinfo() can still format more characters than info->fw_version can hold. The field is ETHTOOL_FWVERS_LEN (32) bytes. With eight 0xff-masked fields, the worst case is 24 digits + 6 dots + ", TP " = 35 characters. In that case, the TP revision reported by ethtool -i is silently cut, for example "200.100.200.100, TP 200.100.20". The switch to scnprintf() doesn't change where the truncation happens. It only removes the warning that pointed to it.
> FW_HDR_FW_VER_MAJOR_G(adapter->params.fw_vers), > FW_HDR_FW_VER_MINOR_G(adapter->params.fw_vers), > FW_HDR_FW_VER_MICRO_G(adapter->params.fw_vers),
[Severity: Low] This isn't a bug, but only the format string line was re-indented to match the new scnprintf( parenthesis. The eight FW_HDR_FW_VER_*_G() argument lines keep the old alignment that matched snprintf(, so one call now has mixed continuation indentation. Could these lines be re-aligned too?
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40cmss.chinamobile.com