Skip to content

Commit

Permalink
timekeeping: Cast raw_interval to u64 to avoid shift overflow
Browse files Browse the repository at this point in the history
commit 5b3900cd409466c0070b234d941650685ad0c791 upstream.

We fixed a bunch of integer overflows in timekeeping code during the 3.6
cycle.  I did an audit based on that and found this potential overflow.

Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: John Stultz <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Ben Hutchings <[email protected]>
[ herton: adapt for 3.5, timekeeper instead of tk pointer ]
Signed-off-by: Herton Ronaldo Krzesinski <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Change-Id: I8dc696732dce90daf739395f6ecdc7c973c89534
  • Loading branch information
Dan Carpenter authored and hemantbeast committed Dec 27, 2016
1 parent 74c619e commit 38729d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
}

/* Accumulate raw time */
raw_nsecs = timekeeper.raw_interval << shift;
raw_nsecs = (u64)timekeeper.raw_interval << shift;
raw_nsecs += timekeeper.raw_time.tv_nsec;
if (raw_nsecs >= NSEC_PER_SEC) {
u64 raw_secs = raw_nsecs;
Expand Down

0 comments on commit 38729d3

Please sign in to comment.