Commit 6a810945 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents 8ab54ed6 0f26922f
...@@ -75,7 +75,7 @@ typedef u64 __nocast cputime64_t; ...@@ -75,7 +75,7 @@ typedef u64 __nocast cputime64_t;
*/ */
static inline cputime_t timespec_to_cputime(const struct timespec *val) static inline cputime_t timespec_to_cputime(const struct timespec *val)
{ {
u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec; u64 ret = (u64)val->tv_sec * NSEC_PER_SEC + val->tv_nsec;
return (__force cputime_t) ret; return (__force cputime_t) ret;
} }
static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) 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,7 +91,8 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
*/ */
static inline cputime_t timeval_to_cputime(const struct timeval *val) static inline cputime_t timeval_to_cputime(const struct timeval *val)
{ {
u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC; u64 ret = (u64)val->tv_sec * NSEC_PER_SEC +
val->tv_usec * NSEC_PER_USEC;
return (__force cputime_t) ret; return (__force cputime_t) ret;
} }
static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment