diff options
author | Anatol Pomozov <anatol.pomozov@gmail.com> | 2013-09-22 14:43:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-01 12:17:48 -0400 |
commit | 85f58908c038a5e1f51fb9014f0b0954f66be1d4 (patch) | |
tree | a83e7b86c7aea1d4790dd084bc2d0ce770ef34f6 | |
parent | edc96e2c36766db781313a53ba130e52e74d3296 (diff) |
cfq: explicitly use 64bit divide operation for 64bit arguments
commit f3cff25f05f2ac29b2ee355e611b0657482f6f1d upstream.
'samples' is 64bit operant, but do_div() second parameter is 32.
do_div silently truncates high 32 bits and calculated result
is invalid.
In case if low 32bit of 'samples' are zeros then do_div() produces
kernel crash.
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Cc: Jonghwan Choi <jhbird.choi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | block/cfq-iosched.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index d5bbdcfd0dab..c410752c5c65 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1803,7 +1803,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, | |||
1803 | 1803 | ||
1804 | if (samples) { | 1804 | if (samples) { |
1805 | v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum); | 1805 | v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum); |
1806 | do_div(v, samples); | 1806 | v = div64_u64(v, samples); |
1807 | } | 1807 | } |
1808 | __blkg_prfill_u64(sf, pd, v); | 1808 | __blkg_prfill_u64(sf, pd, v); |
1809 | return 0; | 1809 | return 0; |