linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: Wen Yang <wenyang@linux.alibaba.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	xlpang@linux.alibaba.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page-writeback.c: avoid potential division by zero
Date: Wed, 1 Jan 2020 07:39:48 -0500	[thread overview]
Message-ID: <230E8A87-2900-427B-9EA3-CC48B4DCA5FC@lca.pw> (raw)
In-Reply-To: <20200101093204.3592-1-wenyang@linux.alibaba.com>



> On Jan 1, 2020, at 4:32 AM, Wen Yang <wenyang@linux.alibaba.com> wrote:
> 
> The variables 'min', 'max' and 'bw' are unsigned long and
> do_div truncates them to 32 bits, which means it can test
> non-zero and be truncated to zero for division.
> Fix this issue by using div64_ul() instead.

How did you find out the issue? If it is caught by compilers, can you paste the original warnings? Also, can you figure out which commit introduced the issue in the first place, so it could be backported to stable if needed?

> 
> For the two variables 'numerator' and 'denominator',
> though they are declared as long, they should actually be
> unsigned long (according to the implementation of
> the fprop_fraction_percpu() function).


  reply	other threads:[~2020-01-01 12:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-01  9:32 Wen Yang
2020-01-01 12:39 ` Qian Cai [this message]
2020-01-02  3:57   ` Wen Yang
2020-01-02  4:06     ` Qian Cai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=230E8A87-2900-427B-9EA3-CC48B4DCA5FC@lca.pw \
    --to=cai@lca.pw \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wenyang@linux.alibaba.com \
    --cc=xlpang@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox