Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1333465 > unrolled thread

[GIT pull] timer updates for 4.5

Started byThomas Gleixner <tglx@linutronix.de>
First post2016-02-14 10:30 +0100
Last post2016-02-14 10:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [GIT pull] timer updates for 4.5 Thomas Gleixner <tglx@linutronix.de> - 2016-02-14 10:30 +0100

#1333465 — [GIT pull] timer updates for 4.5

FromThomas Gleixner <tglx@linutronix.de>
Date2016-02-14 10:30 +0100
Subject[GIT pull] timer updates for 4.5
Message-ID<r21a9-Mi-3@gated-at.bofh.it>
Linus,

please pull the latest timers-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus

A single fix preventing a 32bit overflow in timespec/val to cputime
conversions on 32bit machines.

Thanks,

	tglx

------------------>
zengtao (1):
      cputime: Prevent 32bit overflow in time[val|spec]_to_cputime()


 include/asm-generic/cputime_nsecs.h | 5 +++--
 1 file 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;
  */
 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;
 }
 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)
 {
-	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;
 }
 static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web