[PATCH v2 2/2] wifi: iwlwifi: mld: Fix GP2 to nanoseconds overflow on 32-bit
From: Zhan Xusheng
Date: Thu Oct 01 2026 - 01:02:58 EST
Same problem as the mvm driver: scale_update_gp2 is a u32 GP2 timestamp
in microseconds and NSEC_PER_USEC is 1000L, so on 32-bit
u64 scale_time_gp2_ns = mld->ptp_data.scale_update_gp2 * NSEC_PER_USEC;
truncates to 32 bits for any GP2 value above 4.295 s.
iwl_mld_ptp_gettime() and iwl_mld_ptp_get_crosstimestamp() in the same
file already cast to u64 before multiplying. Do the same here.
Fixes: d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver")
Signed-off-by: Zhan Xusheng <zhanxusheng@xxxxxxxxxx>
---
drivers/net/wireless/intel/iwlwifi/mld/ptp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mld/ptp.c b/drivers/net/wireless/intel/iwlwifi/mld/ptp.c
index 9f7d17dbdee1..643664d35772 100644
--- a/drivers/net/wireless/intel/iwlwifi/mld/ptp.c
+++ b/drivers/net/wireless/intel/iwlwifi/mld/ptp.c
@@ -49,7 +49,8 @@ static void iwl_mld_ptp_update_new_read(struct iwl_mld *mld, u32 gp2)
u64 iwl_mld_ptp_get_adj_time(struct iwl_mld *mld, u64 base_time_ns)
{
struct ptp_data *data = &mld->ptp_data;
- u64 scale_time_gp2_ns = mld->ptp_data.scale_update_gp2 * NSEC_PER_USEC;
+ u64 scale_time_gp2_ns = (u64)mld->ptp_data.scale_update_gp2 *
+ NSEC_PER_USEC;
u64 res;
u64 diff;
s64 scaled_diff;
@@ -149,7 +150,7 @@ static int iwl_mld_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
spin_lock_bh(&data->lock);
data->scale_update_adj_time_ns =
- iwl_mld_ptp_get_adj_time(mld, gp2 * NSEC_PER_USEC);
+ iwl_mld_ptp_get_adj_time(mld, (u64)gp2 * NSEC_PER_USEC);
data->scale_update_gp2 = gp2;
/* scale_update_adj_time_ns now relects the configured delta, the
--
2.43.0