[PATCH] fix 32bit overflow in timespec_to_sample()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



fix 32bit overflow in timespec_to_sample()

Signed-off-by: Oleg Nesterov <[email protected]>

--- 2.6.14-rc/kernel/posix-cpu-timers.c~	2005-10-26 23:33:12.000000000 +0400
+++ 2.6.14-rc/kernel/posix-cpu-timers.c	2005-10-26 23:35:53.000000000 +0400
@@ -36,7 +36,7 @@ timespec_to_sample(clockid_t which_clock
 	union cpu_time_count ret;
 	ret.sched = 0;		/* high half always zero when .cpu used */
 	if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {
-		ret.sched = tp->tv_sec * NSEC_PER_SEC + tp->tv_nsec;
+		ret.sched = (unsigned long long)tp->tv_sec * NSEC_PER_SEC + tp->tv_nsec;
 	} else {
 		ret.cpu = timespec_to_cputime(tp);
 	}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux