diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-01-22 06:26:41 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-22 06:28:02 -0500 |
commit | 5fbaba8603d5bbc9e40bcb970bae64cb7e093755 (patch) | |
tree | bcffaa86c7be757ab4c34283d9b6ec8643101dd9 /include/linux/time.h | |
parent | f2a5473861cf69c03d0f0ee5d0ea1b853b9e582e (diff) | |
parent | 5e5aeb4367b450a28f447f6d5ab57d8f2ab16a5f (diff) |
Merge branch 'fortglx/3.19-stable/time' of https://git.linaro.org/people/john.stultz/linux into timers/urgent
Pull urgent fixes from John Stultz:
Two urgent fixes for user triggerable time related overflow issues
Diffstat (limited to 'include/linux/time.h')
-rw-r--r-- | include/linux/time.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index 203c2ad40d71..beebe3a02d43 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -110,6 +110,19 @@ static inline bool timespec_valid_strict(const struct timespec *ts) | |||
110 | return true; | 110 | return true; |
111 | } | 111 | } |
112 | 112 | ||
113 | static inline bool timeval_valid(const struct timeval *tv) | ||
114 | { | ||
115 | /* Dates before 1970 are bogus */ | ||
116 | if (tv->tv_sec < 0) | ||
117 | return false; | ||
118 | |||
119 | /* Can't have more microseconds then a second */ | ||
120 | if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC) | ||
121 | return false; | ||
122 | |||
123 | return true; | ||
124 | } | ||
125 | |||
113 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | 126 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
114 | 127 | ||
115 | #define CURRENT_TIME (current_kernel_time()) | 128 | #define CURRENT_TIME (current_kernel_time()) |