Re: [PATCH 1/5] gpio: aggregator: fix "_sysfs" prefix check in gpio_aggregator_make_group()

From: Andy Shevchenko

Date: Wed Jan 21 2026 - 09:29:46 EST


On Sat, Apr 12, 2025 at 01:15:00PM +0300, Dan Carpenter wrote:
> This code is intended to reject strings that start with "_sysfs" but the
> strcmp() limit is wrong so checks the whole string instead of the prefix.

...

> if (strncmp(name, AGGREGATOR_LEGACY_PREFIX,
> - sizeof(AGGREGATOR_LEGACY_PREFIX)) == 0)
> + sizeof(AGGREGATOR_LEGACY_PREFIX) - 1) == 0)
> return ERR_PTR(-EINVAL);

Wouldn't be better to use strstarts() / str_has_prefix()?

--
With Best Regards,
Andy Shevchenko