From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Trent Piepho <tpiepho@gmail.com>,
linux-kernel@vger.kernel.org, andy@kernel.org, oskar@scara.com,
Daniel Latypov <dlatypov@google.com>,
Yiyuan Guo <yguoaz@gmail.com>
Subject: Re: [PATCH v2 1/2] lib/math/rational.c: Fix divide by zero
Date: Wed, 26 May 2021 11:00:51 +0300 [thread overview]
Message-ID: <YK4AM3J6W44GTKTA@smile.fi.intel.com> (raw)
In-Reply-To: <20210525144654.e41cb942a2804d08127ad48f@linux-foundation.org>
On Tue, May 25, 2021 at 02:46:54PM -0700, Andrew Morton wrote:
> On Tue, 25 May 2021 07:42:49 -0700 Trent Piepho <tpiepho@gmail.com> wrote:
>
> > If the input is out of the range of the allowed values, either larger
> > than the largest value or closer to zero than the smallest non-zero
> > allowed value, then a division by zero would occur.
> >
> > In the case of input too large, the division by zero will occur on the
> > first iteration. The best result (largest allowed value) will be found
> > by always choosing the semi-convergent and excluding the denominator
> > based limit when finding it.
> >
> > In the case of the input too small, the division by zero will occur on
> > the second iteration. The numerator based semi-convergent should not be
> > calculated to avoid the division by zero. But the semi-convergent vs
> > previous convergent test is still needed, which effectively chooses
> > between 0 (the previous convergent) vs the smallest allowed fraction
> > (best semi-convergent) as the result.
>
> Is there any known userspace workload which can trigger this?
Doubtfully.
What I can imagine (which also can be impossible) is to try on some UART
drivers that use this algorithm to ask crazy baud rates (much higher than the
clock). Sounds like a theoretical possibility is present, but practically
no one except bad hackers would do that (requires a special code to be written
in user space to select BOTHER with an arbitrary input in termios).
> IOW, should it be backported into -stable and fast-tracked into 5.13 or
> will a 5.14 merge suffice?
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2021-05-26 8:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 14:42 [PATCH v2 1/2] lib/math/rational.c: Fix divide by zero Trent Piepho
2021-05-25 14:42 ` [PATCH v2 2/2] lib/math/rational: Add Kunit test cases Trent Piepho
2021-05-25 16:00 ` Andy Shevchenko
2021-05-25 17:34 ` Daniel Latypov
2021-05-25 21:09 ` Trent Piepho
2021-05-25 22:03 ` Daniel Latypov
2021-05-25 21:49 ` Andrew Morton
2021-05-25 16:00 ` [PATCH v2 1/2] lib/math/rational.c: Fix divide by zero Andy Shevchenko
2021-05-25 21:46 ` Andrew Morton
2021-05-26 8:00 ` Andy Shevchenko [this message]
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=YK4AM3J6W44GTKTA@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andy@kernel.org \
--cc=dlatypov@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oskar@scara.com \
--cc=tpiepho@gmail.com \
--cc=yguoaz@gmail.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