[SRU][O][PATCH v2 12/19] UBUNTU: SAUCE: gpio: aggregator: fix "_sysfs" prefix check in gpio_aggregator_make_group()
Koichiro Den
koichiro.den at canonical.com
Tue Apr 15 06:13:38 UTC 2025
From: Dan Carpenter <dan.carpenter at linaro.org>
BugLink: https://bugs.launchpad.net/bugs/2103496
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.
Fixes: 83c8e3df642f ("gpio: aggregator: expose aggregator created via legacy sysfs to configfs")
Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas at glider.be>
Acked-by: Koichiro Den <koichiro.den at canonical.com>
Link: https://lore.kernel.org/r/30210ed77b40b4b6629de659cb56b9ec7832c447.1744452787.git.dan.carpenter@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl at bgdev.pl>
(cherry picked from commit eebfcb98cdc0228f5e1b7407f9db1c602bd8e545 gpio/for-next)
Signed-off-by: Koichiro Den <koichiro.den at canonical.com>
---
drivers/gpio/gpio-aggregator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c
index a51b01a058bd..bbcb33bcaa9d 100644
--- a/drivers/gpio/gpio-aggregator.c
+++ b/drivers/gpio/gpio-aggregator.c
@@ -1004,7 +1004,7 @@ gpio_aggregator_make_group(struct config_group *group, const char *name)
* for devices create via legacy sysfs interface.
*/
if (strncmp(name, AGGREGATOR_LEGACY_PREFIX,
- sizeof(AGGREGATOR_LEGACY_PREFIX)) == 0)
+ sizeof(AGGREGATOR_LEGACY_PREFIX) - 1) == 0)
return ERR_PTR(-EINVAL);
/* arg space is unneeded */
--
2.45.2
More information about the kernel-team
mailing list