Re: [PATCH] cfq: explicitly use 64bit divide operation for 64bit arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Tejun

On Fri, Aug 30, 2013 at 10:52 AM, Anatol Pomozov
<anatol.pomozov@xxxxxxxxx> wrote:
> '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@xxxxxxxxx>
> ---
>  block/cfq-iosched.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index d5bbdcf..c410752 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,
>
>         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;

what do you think about this patch?
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux