[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220304152136.035911620@infradead.org>
Date: Fri, 04 Mar 2022 16:19:56 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: x86@...nel.org, mathias.nyman@...ux.intel.com,
gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, peterz@...radead.org,
rdunlap@...radead.org, linux-usb@...r.kernel.org
Subject: [PATCH 3/3] usb: early: xhci-dbc: Fix xdbc number parsing
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@...radead.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) {
+ dbgp_num = simple_strtoul(s, &e, 10);
+ if (s == e)
+ dbgp_num = 0;
+ }
pr_notice("dbgp_num: %lu\n", dbgp_num);
Powered by blists - more mailing lists