aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/time.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/time.h b/include/linux/time.h
index b0bbd8f0130d..b51e664c83e7 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -125,6 +125,13 @@ static inline bool timespec_valid(const struct timespec *ts)
125 /* Can't have more nanoseconds then a second */ 125 /* Can't have more nanoseconds then a second */
126 if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC) 126 if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC)
127 return false; 127 return false;
128 return true;
129}
130
131static inline bool timespec_valid_strict(const struct timespec *ts)
132{
133 if (!timespec_valid(ts))
134 return false;
128 /* Disallow values that could overflow ktime_t */ 135 /* Disallow values that could overflow ktime_t */
129 if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) 136 if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
130 return false; 137 return false;