Subject: [PATCH net] ethtool: Set histogram ranges to NULL before querying FEC data

From: Eric Joyner <[email-masked]>
Date: Thu, 4 Jun 2026 15:54:40 -0700

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.

Fixes: cc2f08129925 ("ethtool: add FEC bins histogram report")
Signed-off-by: Eric Joyner <[email-masked]>
---
 net/ethtool/fec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ethtool/fec.c b/net/ethtool/fec.c
index e2d539271060..640d7f264919 100644
--- a/net/ethtool/fec.c
+++ b/net/ethtool/fec.c
@@ -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
-- 
2.17.1