From: Guido Günther Date: Wed, 22 Jan 2020 10:43:11 +0000 (+0100) Subject: etnaviv: drm: Don't miscalculate timeout X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=commitdiff_plain;h=d817f2c69615cf37b78f484a25b7831ebe9dbe6f etnaviv: drm: Don't miscalculate timeout The current code overflows (s * 1000000000) for s >= 5 but that is e.g. used in etna_bo_cpu_prep. Signed-off-by: Guido Günther Reviewed-by: Jonathan Marek Tested-by: Marge Bot Part-of: --- diff --git a/src/etnaviv/drm/etnaviv_priv.h b/src/etnaviv/drm/etnaviv_priv.h index 2ab0e473ea9..8ceb6c3c431 100644 --- a/src/etnaviv/drm/etnaviv_priv.h +++ b/src/etnaviv/drm/etnaviv_priv.h @@ -204,10 +204,9 @@ struct etna_perfmon_signal static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint64_t ns) { struct timespec t; - uint32_t s = ns / 1000000000; clock_gettime(CLOCK_MONOTONIC, &t); - tv->tv_sec = t.tv_sec + s; - tv->tv_nsec = t.tv_nsec + ns - (s * 1000000000); + tv->tv_sec = t.tv_sec + ns / 1000000000; + tv->tv_nsec = t.tv_nsec + ns % 1000000000; } #if HAVE_VALGRIND