Re: [PATCH] x86/tsc: Fix early boot crash with bare tsc_early_khz parameter
From: Thorsten Blum
Date: Wed Nov 11 2026 - 09:42:28 EST
On Tue, Nov 10, 2026 at 11:44:55AM -0800, Dave Hansen wrote:
> On 11/10/26 07:05, Thorsten Blum wrote:
> > static int __init tsc_early_khz_setup(char *buf)
> > {
> > + if (!buf)
> > + return -EINVAL;
> > +
> > return kstrtouint(buf, 0, &tsc_early_khz);
> > }
>
> This _seems_ like the kind of thing that should ideally just be done in
> kstrtouint().
>
> Is there a reason we can't just do what kstrtobool() does when handed
> buf=NULL?
I don't see a technical reason why we couldn't, but that would
potentially change the behavior of every kstrto*() caller and be a
broader change than this fix.
Here NULL is expected (for params without the '=' separator), so I kept
the check local to match other early_param handlers that use kstrto*(),
e.g., set_corruption_check(), set_corruption_check_period(), and
parse_mtrr_spare_reg().