diff options
author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2009-08-25 02:08:30 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-25 03:09:02 -0400 |
commit | 36d47481b3824b661b464077db95d447984df799 (patch) | |
tree | 7ae9dc060872f879403e78ab1b1abd7f4ada4ed0 | |
parent | 0ceb4c3e3f1ccaf121851e33c3ea269b8ad0f219 (diff) |
timekeeping: Fix invalid getboottime() value
Don't use timespec_add_safe() with wall_to_monotonic, because
wall_to_monotonic has negative values which will cause overflow
in timespec_add_safe(). That makes btime in /proc/stat invalid.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Daniel Walker <dwalker@fifo99.com>
LKML-Reference: <4A937FDE.4050506@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/time/timekeeping.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 03cbeb34d141..fb0f46fa1ecd 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -826,9 +826,11 @@ void update_wall_time(void) | |||
826 | */ | 826 | */ |
827 | void getboottime(struct timespec *ts) | 827 | void getboottime(struct timespec *ts) |
828 | { | 828 | { |
829 | struct timespec boottime; | 829 | struct timespec boottime = { |
830 | .tv_sec = wall_to_monotonic.tv_sec + total_sleep_time.tv_sec, | ||
831 | .tv_nsec = wall_to_monotonic.tv_nsec + total_sleep_time.tv_nsec | ||
832 | }; | ||
830 | 833 | ||
831 | boottime = timespec_add_safe(wall_to_monotonic, total_sleep_time); | ||
832 | set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec); | 834 | set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec); |
833 | } | 835 | } |
834 | 836 | ||