Hi Chris,
On Fri, 21 Nov 2025 at 05:04, Chris Brandt <[email protected]> wrote:
> On Wed, Nov 19, 2025 1:23 PM, Hugo Villeneuve wrote:
> > > + params->pl5_fracin = div_u64((u64)
> > > + ((foutvco_rate *
> > > params->pl5_refdiv) %
> > > + (EXTAL_FREQ_IN_MEGA_HZ *
> > > MEGA)) << 24,
> > > + EXTAL_FREQ_IN_MEGA_HZ *
> > > MEGA);
> > >
> > >
> > > Also:
> > > foutvco_rate (max) = 3000000000 (3GHz)
> > > pl5_refdiv (max) = 2
> > >
> > > so the result of (foutvco_rate * params->pl5_refdiv) could become
> > > 6GHz, which is greater than unsigned long on 32-bit platform and overflow?
> >
> > I confirm that when testing with "COMPILE_TEST" as Geert suggested on a
> > 32-bit platform, the results are not
> > valid for this combination (but they are valid on 64-bit platforms).
> >
> > I think that the kernel robot could potentially issue a build warning for
> > 32-bit platforms (if they also build with
> > COMPILE_TEST enabled, which I'm not sure about). Maybe Geert could comment
> > on this?
>
> I've got no comment here.
>
> I can't image when someone would ever want to compile this code for a 32-bit
> system.
>
> So I'll leave it as it is now unless Geert wants me to change it to something
> else.
Pieces of code are reused all the time. So I think it is better to make
sure it doesn't overflow on 32-bit.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds