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.
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220304152136.035911620@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
{
unsigned long dbgp_num = 0;
u32 bus, dev, func, offset;
+ char *e;
int ret;
if (!early_pci_allowed())
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);