diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-14 14:57:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-14 14:57:24 -0500 |
commit | 6a810945ed23554aa71634ff0bf976da41de9045 (patch) | |
tree | a022eb43238d26f0cde3afcb93db31a6dbe46bc2 | |
parent | 8ab54ed6412f42a1769cf64d4900f49a422d4292 (diff) | |
parent | 0f26922fe5dc5724b1adbbd54b21bad03590b4f3 (diff) |
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fix from Thomas Gleixner:
"A single fix preventing a 32bit overflow in timespec/val to cputime
conversions on 32bit machines"
* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
cputime: Prevent 32bit overflow in time[val|spec]_to_cputime()
-rw-r--r-- | include/asm-generic/cputime_nsecs.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h index 0419485891f2..0f1c6f315cdc 100644 --- a/include/asm-generic/cputime_nsecs.h +++ b/include/asm-generic/cputime_nsecs.h | |||
@@ -75,7 +75,7 @@ typedef u64 __nocast cputime64_t; | |||
75 | */ | 75 | */ |
76 | static inline cputime_t timespec_to_cputime(const struct timespec *val) | 76 | static inline cputime_t timespec_to_cputime(const struct timespec *val) |
77 | { | 77 | { |
78 | u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec; | 78 | u64 ret = (u64)val->tv_sec * NSEC_PER_SEC + val->tv_nsec; |
79 | return (__force cputime_t) ret; | 79 | return (__force cputime_t) ret; |
80 | } | 80 | } |
81 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) | 81 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) |
@@ -91,7 +91,8 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) | |||
91 | */ | 91 | */ |
92 | static inline cputime_t timeval_to_cputime(const struct timeval *val) | 92 | static inline cputime_t timeval_to_cputime(const struct timeval *val) |
93 | { | 93 | { |
94 | u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC; | 94 | u64 ret = (u64)val->tv_sec * NSEC_PER_SEC + |
95 | val->tv_usec * NSEC_PER_USEC; | ||
95 | return (__force cputime_t) ret; | 96 | return (__force cputime_t) ret; |
96 | } | 97 | } |
97 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) | 98 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) |