lkml.org 
[lkml]   [2020]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] x86/fpu: Allow clearcpuid= to clear several bits

Thanks good catch.

> if (cmdline_find_option(boot_command_line, "clearcpuid", arg,
> - sizeof(arg)) &&
> - get_option(&argptr, &bit) &&
> - bit >= 0 &&
> - bit < NCAPINTS * 32)
> - setup_clear_cpu_cap(bit);
> + sizeof(arg))) {
> + /* cpuid bit numbers are mostly three digits */
> + enum { nints = sizeof(arg)/(3+1) + 1 };

Not sure what the digits have to do with the stack space of an int array.

We should have enough stack to afford some more than 8.

Would be good to have a warning if the arguments are longer.

Maybe it would be simpler to fix the early arg parser
to allow multiple instances again? That would also avoid the limit,
and keep everything compatible.

-Andi


> + int i, bits[nints];
> +
> + get_options(arg, nints, bits);
> + for (i = 1; i <= bits[0]; i++) {
> + if (bits[i] >= 0 && bits[i] < NCAPINTS * 32)
> + setup_clear_cpu_cap(bits[i]);
> + }
> + }
> }
>
> /*
> --
> 2.25.3
>

\
 
 \ /
  Last update: 2020-04-22 16:36    [W:0.050 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site