From: Oleg Nesterov Date: Mon, 28 Nov 2005 21:43:55 +0000 (-0800) Subject: [PATCH] fix 32bit overflow in timespec_to_sample() X-Git-Tag: v2.6.15-rc3~23 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee500f274914653a7d3dfca7d0140a3d21658e32;p=linux-2.6 [PATCH] fix 32bit overflow in timespec_to_sample() fix 32bit overflow in timespec_to_sample() Signed-off-by: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 84af54c39e..cae4f57289 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c @@ -36,7 +36,7 @@ timespec_to_sample(clockid_t which_clock, const struct timespec *tp) 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); }