Skip to contentSkip to conversation

fix 32bit overflow in timespec_to_sample()

PATCH New Oleg Nesterov 1 participant 1 message Nov 24, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix 32bit overflow in timespec_to_sample()

fix 32bit overflow in timespec_to_sample()

kernel/posix-cpu-timers.c renamed from kernel/posix-cpu-timers.c~ +1 -1
@@ -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);
 	}