Refactor timespec to microsecond conversion
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | time: Add timespec to microseconds converterell/ ell/ ell/ | +28 | 1 reply | |
| 2/4 | unit: Add l_timespec_to_usecs() unit test.unit/ | +34 | 1 reply | |
| 3/4 | time: Use l_timespec_to_usecs() to avoid overflow.ell/ | +1 | 1 reply | |
| 4/4 | path: Use l_timespec_to_usecs() to avoid overflow.ell/ | +1 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/4] Refactor timespec to microsecond conversion
An integer overflow fix for a timespec to microsecond conversion in l_path_get_mtime() was previously committed but two overflows could still occur: (1) the multiplication in the seconds (tv_sec) to microsecond conversion could still exceed UINT64_MAX, and (2) addition of the microseconds obtained from the nanoseconds (tv_nsec) member could also result in a sum that exceeds UINT64_MAX.
This set of patches refactors the timespec to microsecond to a new l_timespec_to_usecs() function that checks for overflow in both of the cases mentioned above. The l_path_get_mtime() function now uses l_timespec_to_usecs() to address the remaining potential integer overflows. A potential integer overflow in the l_time_now() function was corrected in a similar manner.
Ossama Othman (4):
time: Add timespec to microseconds converter
unit: Add l_timespec_to_usecs() unit test.
time: Use l_timespec_to_usecs() to avoid overflow.
path: Use l_timespec_to_usecs() to avoid overflow.
ell/ell.sym | 1 + ell/path.c | 3 +-- ell/time.c | 26 +++++++++++++++++++++++++- ell/time.h | 3 +++ unit/test-time.c | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 3 deletions(-)
Signature · 1 line
2.20.1