drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
get_time_fn() callback implementations are expected to fill out the
entire system_counterval_t struct as it may be initially uninitialized.
This broke with the removal of convert_art_to_tsc() helper functions
which left use_nsecs uninitialized.
Initially assign the entire struct with default values.
Fixes: f5e1d0db3f02 ("stmmac: intel: Remove convert_art_to_tsc()")
Cc: stable@vger.kernel.org
Signed-off-by: Markus Blöchl <markus@blochl.de>
---
Notes:
Related-To: <https://lore.kernel.org/lkml/txyrr26hxe3xpq3ebqb5ewkgvhvp7xalotaouwludjtjifnah2@7tmgczln4aoo/>
Related-To: <https://lore.kernel.org/lkml/20250709-e1000e_crossts-v2-1-2aae94384c59@blochl.de/>
Only compile tested
---
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
index 9a47015254bbe60b806b00b80dbd5b1d8f78a7c6..ea33ae39be6bbca5dc32c73e6d02e86a9d8d6e62 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
@@ -433,6 +433,12 @@ static int intel_crosststamp(ktime_t *device,
return -ETIMEDOUT;
}
+ *system = (struct system_counterval_t) {
+ .cycles = 0,
+ .cs_id = CSID_X86_ART,
+ .use_nsecs = false,
+ };
+
num_snapshot = (readl(ioaddr + GMAC_TIMESTAMP_STATUS) &
GMAC_TIMESTAMP_ATSNS_MASK) >>
GMAC_TIMESTAMP_ATSNS_SHIFT;
@@ -448,7 +454,7 @@ static int intel_crosststamp(ktime_t *device,
}
system->cycles *= intel_priv->crossts_adj;
- system->cs_id = CSID_X86_ART;
+
priv->plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN;
return 0;
---
base-commit: 3cd752194e2ec2573d0e740f4a1edbfcc28257f5
change-id: 20250713-stmmac_crossts-34d8ab89901a
Best regards,
--
Markus Blöchl <markus@blochl.de>
On Sun, Jul 13 2025 at 22:21, Markus Blöchl wrote: > get_time_fn() callback implementations are expected to fill out the > entire system_counterval_t struct as it may be initially uninitialized. > > This broke with the removal of convert_art_to_tsc() helper functions > which left use_nsecs uninitialized. Sigh. As I explained in the other thread, the proper fix is to zero initialize the data structure at the call site and fix this whole class of issues in one go.
On Sun, Jul 13, 2025 at 10:21:41PM +0200, Markus Blöchl wrote: > get_time_fn() callback implementations are expected to fill out the > entire system_counterval_t struct as it may be initially uninitialized. > > This broke with the removal of convert_art_to_tsc() helper functions > which left use_nsecs uninitialized. > > Initially assign the entire struct with default values. > > Fixes: f5e1d0db3f02 ("stmmac: intel: Remove convert_art_to_tsc()") > Cc: stable@vger.kernel.org > Signed-off-by: Markus Blöchl <markus@blochl.de> Reviewed-by: Simon Horman <horms@kernel.org>
© 2016 - 2025 Red Hat, Inc.