Re: [PATCH 02/12] gpiolib: acpi: Modernize string parsing in quirks layer
From: Andy Shevchenko
Date: Mon May 18 2026 - 04:12:05 EST
On Mon, May 18, 2026 at 09:53:47AM +0200, Marco Scardovi (scardracs) wrote:
We do not accept patches with empty commit messages (it's not 2007 out there).
> Assisted-by: Antigravity:gemini-3-flash
> Signed-off-by: Marco Scardovi <mscardovi95@xxxxxxxxx>
> ---
> if (len == strlen(controller_in) &&
> strncmp(controller, controller_in, len) == 0) {
> - pin = simple_strtoul(pin_str + 1, &endp, 10);
> - if (*endp != 0 && *endp != ',')
> + char pin_buf[16];
> + size_t pin_len = 0;
> + const char *p = pin_str + 1;
Keep it in reversed xmas tree order.
> +
> + while (*p && *p != ',') {
> + if (pin_len < sizeof(pin_buf) - 1)
> + pin_buf[pin_len++] = *p;
> + else
> + goto err;
> + p++;
> + }
> + pin_buf[pin_len] = '\0';
> +
> + if (kstrtouint(pin_buf, 10, &pin))
This returns an error code, is it got shadowed on purpose?
> goto err;
...
The temporary buffer makes an unneeded churn. simple_strtoul() will work okay.
Even if it's an overflow, it's user's responsibility. And since we have this
already, it's now part of ABI (kernel command line comes from outside of the
kernel).
--
With Best Regards,
Andy Shevchenko