ethtool: Set histogram ranges to NULL before querying FEC data
Subsystems (3)
PATCH 1/1 ethtool: Set histogram ranges to NULL before querying FEC data
If this field isn't set to NULL, then drivers that set the non-histogram FEC statistics and don't support/modify the histogram fields will trigger a WARN_ON() in fec_put_hist(). Drivers shouldn't be forced to set this field to NULL if they don't have a need to touch FEC histogram reporting, so set this field before the driver gets the data structure.
--- net/ethtool/fec.c | 1 + 1 file changed, 1 insertion(+)
net/ethtool/fec.c +1 -0
@@ -116,6 +116,7 @@ static int fec_prepare_data(const struct ethnl_req_info *req_base,ethtool_stats_init ((u64 *)&stats,sizeof (stats) /8 );ethtool_stats_init ((u64 *)data->fec_stat_hist.values,sizeof (data->fec_stat_hist.values) /8 ); + data->fec_stat_hist.ranges =NULL ; dev->ethtool_ops->get_fec_stats (dev, &stats, &data->fec_stat_hist);
base-commit: b6197b386677ae5268d4702e23849d9ad53051ad
Signature · 1 line
2.17.1
Jakub Kicinski
maintainerQuoted 5 lines · On Thu, 4 Jun 2026 15:54:40 -0700 Eric Joyner wrote:
If this field isn't set to NULL, then drivers that set the non-histogram FEC statistics and don't support/modify the histogram fields will trigger a
WARN_ON()infec_put_hist(). Drivers shouldn't be forced to set this field to NULL if they don't have a need to touch FEC histogram reporting, so set this field before the driver gets the data structure.
&data should be zero-initialized, how is this patch not a nop?
Are you sure this can trigger unless the driver is buggy and sets ranges without reporting any values?
Quoted 10 lines · Jakub Kicinski
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 5 lines · On Thu, 4 Jun 2026 15:54:40 -0700 Eric Joyner wrote:
If this field isn't set to NULL, then drivers that set the non-histogram FEC statistics and don't support/modify the histogram fields will trigger a
WARN_ON()infec_put_hist(). Drivers shouldn't be forced to set this field to NULL if they don't have a need to touch FEC histogram reporting, so set this field before the driver gets the data structure.
Quoted 5 lines
&data should be zero-initialized, how is this patch not a nop?
Are you sure this can trigger unless the driver is buggy and sets ranges without reporting any values?
I'm double-checked this, and you're right; the memory gets zeroed, and so the situation I described shouldn't happen.
It must have been some buggy in-between version driver I was using, but I can't reproduce this and have no idea what I did to trigger it; I'm guessing I did what you suggested and only partially set the histogram values somehow.
Drop this patch; and I'm sorry about the noise.
- Eric