mbox series

[0/3] x86: Make XDBC work

Message ID 20220304151953.830111479@infradead.org
Headers show
Series x86: Make XDBC work | expand

Message

Peter Zijlstra March 4, 2022, 3:19 p.m. UTC
Hi!

These are the patches I needed to make XDBC go on my tigerlake NUC.

Comments

Mathias Nyman March 8, 2022, 10:01 a.m. UTC | #1
On 4.3.2022 17.19, Peter Zijlstra wrote:
> kstrtoul() assumes the string contains the number only and is \0
> terminated, this is not the case, as such things like:
> 
> 	earlyprintk=xdbc1,keep
> 
> go completely sideways. Use simple_strtoul() instead.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  drivers/usb/early/xhci-dbc.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> --- a/drivers/usb/early/xhci-dbc.c
> +++ b/drivers/usb/early/xhci-dbc.c
> @@ -603,6 +603,7 @@ int __init early_xdbc_parse_parameter(ch
>  {
>  	unsigned long dbgp_num = 0;
>  	u32 bus, dev, func, offset;
> +	char *e;
>  	int ret;
>  
>  	if (!early_pci_allowed())
> @@ -613,8 +614,11 @@ int __init early_xdbc_parse_parameter(ch
>  	if (xdbc.xdbc_reg)
>  		return 0;
>  
> -	if (*s && kstrtoul(s, 0, &dbgp_num))
> -		dbgp_num = 0;
> +	if (*s) {

Do you think we need a code comment here stating something like
"use deprecated simple_strtoul() as kstrtoul can't handle characters after the number"

> +	       dbgp_num = simple_strtoul(s, &e, 10);
> +	       if (s == e)
> +		       dbgp_num = 0;
> +	}
>  

If not then PATCH 2/3 and 3/3 looks good to me
I don't know much about PATCH 1/3, the tsc change, but it didn't cause any issues for me either.

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>

Thanks
-Mathias