Re: [PATCH v2] net: ethtool: do not call get_regs() for zero-length dumps
From: YuanZhe Liu
Date: Fri Nov 27 2026 - 02:24:37 EST
On Fri, Nov 27, 2026 at 02:41:47AM +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> [Medium] Can this early return hide errors from get_regs_len()?
>
> [Low] For drivers whose get_regs_len() returns a positive value, does
> this change what a len == 0 query returns in regs.version?
Both points are valid.
The Medium one is a real regression. ethtool -d sends a zero-length
request exactly when ETHTOOL_GDRVINFO reported no regdump_len, which is
what happens when get_regs_len() fails, so the early return would hide
-EOPNOTSUPP from DSA user ports and hns3. I moved the zero-length check
after the get_regs_len() result check; only drivers which report a
positive length skip the callback now.
For the Low one, a zero-length dump returns no data and, with the
callback skipped, it no longer fills in regs.version. I documented that
in the commit message: the uAPI points users at ETHTOOL_GDRVINFO for the
size, and ethtool(8) always sends regdump_len for drivers that report
one, so there is no version-only query to preserve.
v4 posted separately:
https://lore.kernel.org/r/20261127072348.5277-1-25031212351@xxxxxxxxxxxxxxxxx/
pw-bot: cr