summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-01-22 12:26:41 +0100
committerThomas Gleixner <tglx@linutronix.de>2015-01-22 12:28:02 +0100
commit5fbaba8603d5bbc9e40bcb970bae64cb7e093755 (patch)
treebcffaa86c7be757ab4c34283d9b6ec8643101dd9 /include/linux
parentf2a5473861cf69c03d0f0ee5d0ea1b853b9e582e (diff)
parent5e5aeb4367b450a28f447f6d5ab57d8f2ab16a5f (diff)
downloadlwn-5fbaba8603d5bbc9e40bcb970bae64cb7e093755.tar.gz
lwn-5fbaba8603d5bbc9e40bcb970bae64cb7e093755.zip
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')
-rw-r--r--include/linux/time.h13
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)
return true;
}
+static inline bool timeval_valid(const struct timeval *tv)
+{
+ /* Dates before 1970 are bogus */
+ if (tv->tv_sec < 0)
+ return false;
+
+ /* Can't have more microseconds then a second */
+ if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
+ return false;
+
+ return true;
+}
+
extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
#define CURRENT_TIME (current_kernel_time())