[LTP] [PATCH] include/tst_timer.h: Fix overflows

Petr Vorel pvorel@suse.cz
Mon Jan 18 11:42:26 CET 2021


Hi Cyril,

> This fixes overflows in tst_timeval_to_us() and tst_timeval_to_ns() on
> 32bit hardware. We have to cast the tv_sec (ulong) to (long long)
> explicitly otherwise the tv_sec will overflow the multiplication.

> This fixes clock_gettime04 where the overflow corrupted the result from
> gettimeofday() when it was converted from timeval to timespec.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list