lkml.org 
[lkml]   [2019]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: fix int_sqrt() for very large numbers
On Sun, Jan 20, 2019 at 5:03 PM Florian La Roche
<florian.laroche@googlemail.com> wrote:
>
> The real bug is that we compute 1 to 64 for bit 0 to bit 63, whereas
> the algorithm expects 0 to 63 for the value of m.

Florian, you seem to be in denial.

__fls() returns 0-63. Your patch is *wrong* for the __fls() use,
because when you subtract 1, you get -1 to 62, and the -1 now
introduces the very undefined behavior you claim your patch fixes.

So your patch fixes one real case (int_sqrt64(), that has one user
that doesn't care) but it *BREAKS* the other case that is actually
much more widely used (int_sqrt()).

See what Will and I are complainig about?

Linus

\
 
 \ /
  Last update: 2019-01-20 06:12    [W:0.079 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site