On 32-bit architectures, time_t is 32-bit which causes overflows in the arithmetic involving tv_sec, leading to invalid output. Fix this by explicitly adding ULL suffixes to the constants used in those calculations. Fixes: 3708f614dfdd ("iw: Print current time in station info dump") Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxx> --- station.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/station.c b/station.c index bddea51815ee..002cf13526cc 100644 --- a/station.c +++ b/station.c @@ -337,7 +337,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg) unsigned long long now_ms; gettimeofday(&now, NULL); - now_ms = now.tv_sec * 1000; + now_ms = now.tv_sec * 1000ULL; now_ms += (now.tv_usec / 1000); nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), @@ -601,7 +601,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg) unsigned long long assoc_at_ms; clock_gettime(CLOCK_BOOTTIME, &now_ts); - boot_ns = now_ts.tv_sec * 1000000000; + boot_ns = now_ts.tv_sec * 1000000000ULL; boot_ns += now_ts.tv_nsec; bt = (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_ASSOC_AT_BOOTTIME]); -- 2.30.2