Re: [PATCH 1/1] x86/fpu: Allow clearcpuid= to clear several bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> 



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux