[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <230E8A87-2900-427B-9EA3-CC48B4DCA5FC@lca.pw>
Date: Wed, 1 Jan 2020 07:39:48 -0500
From: Qian Cai <cai@....pw>
To: Wen Yang <wenyang@...ux.alibaba.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
xlpang@...ux.alibaba.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/page-writeback.c: avoid potential division by zero
> On Jan 1, 2020, at 4:32 AM, Wen Yang <wenyang@...ux.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).
Powered by blists - more mailing lists