mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
cfq: explicitly use 64bit divide operation for 64bit arguments
commit f3cff25f05 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
This commit is contained in:
committed by
Kamal Mostafa
parent
0029eae064
commit
d6150c6fc3
@@ -1484,7 +1484,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
|
||||
|
||||
if (samples) {
|
||||
v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
|
||||
do_div(v, samples);
|
||||
v = div64_u64(v, samples);
|
||||
}
|
||||
__blkg_prfill_u64(sf, pd, v);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user