Messages in this thread | | | From | Linus Torvalds <> | Date | Sun, 20 Jan 2019 17:11:14 +1200 | Subject | Re: 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
| |