mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-12 00:38:55 +00:00
cfq: explicitly use 64bit divide operation for 64bit arguments
'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>
This commit is contained in:
parent
75afb35299
commit
f3cff25f05
@ -1803,7 +1803,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
|
|||||||
|
|
||||||
if (samples) {
|
if (samples) {
|
||||||
v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
|
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);
|
__blkg_prfill_u64(sf, pd, v);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user